@@ -45,6 +45,7 @@ use std::u16;
45
45
use std:: u32;
46
46
use std:: u64;
47
47
use std:: u8;
48
+ use std:: gc:: Gc ;
48
49
use syntax:: abi;
49
50
use syntax:: ast_map;
50
51
use syntax:: attr:: AttrMetaMethods ;
@@ -98,8 +99,8 @@ impl LintPass for UnusedCasts {
98
99
fn check_expr ( & mut self , cx : & Context , e : & ast:: Expr ) {
99
100
match e. node {
100
101
ast:: ExprCast ( expr, ty) => {
101
- let t_t = ast_ty_to_ty ( cx, & infer:: new_infer_ctxt ( cx. tcx ) , ty) ;
102
- if ty:: get ( ty:: expr_ty ( cx. tcx , expr) ) . sty == ty:: get ( t_t) . sty {
102
+ let t_t = ast_ty_to_ty ( cx, & infer:: new_infer_ctxt ( cx. tcx ) , & * ty) ;
103
+ if ty:: get ( ty:: expr_ty ( cx. tcx , & * expr) ) . sty == ty:: get ( t_t) . sty {
103
104
cx. span_lint ( UNNECESSARY_TYPECAST , ty. span , "unnecessary type cast" ) ;
104
105
}
105
106
}
@@ -150,7 +151,7 @@ impl LintPass for TypeLimits {
150
151
}
151
152
} ,
152
153
_ => {
153
- let t = ty:: expr_ty ( cx. tcx , expr) ;
154
+ let t = ty:: expr_ty ( cx. tcx , & * expr) ;
154
155
match ty:: get ( t) . sty {
155
156
ty:: ty_uint( _) => {
156
157
cx. span_lint ( UNSIGNED_NEGATE , e. span ,
@@ -170,7 +171,7 @@ impl LintPass for TypeLimits {
170
171
self . negated_expr_id = expr. id ;
171
172
} ,
172
173
ast:: ExprBinary ( binop, l, r) => {
173
- if is_comparison ( binop) && !check_limits ( cx. tcx , binop, l, r) {
174
+ if is_comparison ( binop) && !check_limits ( cx. tcx , binop, & * l, & * r) {
174
175
cx. span_lint ( TYPE_LIMITS , e. span ,
175
176
"comparison is useless due to type limits" ) ;
176
177
}
@@ -202,6 +203,7 @@ impl LintPass for TypeLimits {
202
203
} else { t } ;
203
204
let ( min, max) = uint_ty_range ( uint_type) ;
204
205
let lit_val: u64 = match lit. node {
206
+ ast:: LitByte ( _v) => return , // _v is u8, within range by definition
205
207
ast:: LitInt ( v, _) => v as u64 ,
206
208
ast:: LitUint ( v, _) => v,
207
209
ast:: LitIntUnsuffixed ( v) => v as u64 ,
@@ -350,24 +352,24 @@ impl LintPass for CTypes {
350
352
_ => ( )
351
353
}
352
354
}
353
- ast:: TyPtr ( ref mt) => { check_ty ( cx, mt. ty ) }
355
+ ast:: TyPtr ( ref mt) => { check_ty ( cx, & * mt. ty ) }
354
356
_ => { }
355
357
}
356
358
}
357
359
358
360
fn check_foreign_fn ( cx : & Context , decl : & ast:: FnDecl ) {
359
361
for input in decl. inputs . iter ( ) {
360
- check_ty ( cx, input. ty ) ;
362
+ check_ty ( cx, & * input. ty ) ;
361
363
}
362
- check_ty ( cx, decl. output )
364
+ check_ty ( cx, & * decl. output )
363
365
}
364
366
365
367
match it. node {
366
368
ast:: ItemForeignMod ( ref nmod) if nmod. abi != abi:: RustIntrinsic => {
367
369
for ni in nmod. items . iter ( ) {
368
370
match ni. node {
369
- ast:: ForeignItemFn ( decl, _) => check_foreign_fn ( cx, decl) ,
370
- ast:: ForeignItemStatic ( t, _) => check_ty ( cx, t)
371
+ ast:: ForeignItemFn ( decl, _) => check_foreign_fn ( cx, & * decl) ,
372
+ ast:: ForeignItemStatic ( t, _) => check_ty ( cx, & * t)
371
373
}
372
374
}
373
375
}
@@ -397,9 +399,6 @@ impl HeapMemory {
397
399
n_box += 1 ;
398
400
}
399
401
ty:: ty_uniq( _) |
400
- ty:: ty_trait( box ty:: TyTrait {
401
- store : ty:: UniqTraitStore , ..
402
- } ) |
403
402
ty:: ty_closure( box ty:: ClosureTy {
404
403
store : ty:: UniqTraitStore ,
405
404
..
@@ -523,7 +522,7 @@ impl LintPass for RawPointerDeriving {
523
522
match item. node {
524
523
ast:: ItemStruct ( ..) | ast:: ItemEnum ( ..) => {
525
524
let mut visitor = RawPtrDerivingVisitor { cx : cx } ;
526
- visit:: walk_item ( & mut visitor, item, ( ) ) ;
525
+ visit:: walk_item ( & mut visitor, & * item, ( ) ) ;
527
526
}
528
527
_ => { }
529
528
}
@@ -547,7 +546,6 @@ impl LintPass for UnusedAttribute {
547
546
548
547
// FIXME: #14406 these are processed in trans, which happens after the
549
548
// lint pass
550
- "address_insignificant" ,
551
549
"cold" ,
552
550
"inline" ,
553
551
"link" ,
@@ -653,7 +651,7 @@ impl LintPass for UnusedResult {
653
651
ast:: StmtSemi ( expr, _) => expr,
654
652
_ => return
655
653
} ;
656
- let t = ty:: expr_ty ( cx. tcx , expr) ;
654
+ let t = ty:: expr_ty ( cx. tcx , & * expr) ;
657
655
match ty:: get ( t) . sty {
658
656
ty:: ty_nil | ty:: ty_bot | ty:: ty_bool => return ,
659
657
_ => { }
@@ -663,7 +661,7 @@ impl LintPass for UnusedResult {
663
661
_ => { }
664
662
}
665
663
666
- let t = ty:: expr_ty ( cx. tcx , expr) ;
664
+ let t = ty:: expr_ty ( cx. tcx , & * expr) ;
667
665
let mut warned = false ;
668
666
match ty:: get ( t) . sty {
669
667
ty:: ty_struct( did, _) |
@@ -698,31 +696,6 @@ impl LintPass for UnusedResult {
698
696
}
699
697
}
700
698
701
- declare_lint ! ( DEPRECATED_OWNED_VECTOR , Allow ,
702
- "use of a `~[T]` vector" )
703
-
704
- pub struct DeprecatedOwnedVector ;
705
-
706
- impl LintPass for DeprecatedOwnedVector {
707
- fn get_lints ( & self ) -> LintArray {
708
- lint_array ! ( DEPRECATED_OWNED_VECTOR )
709
- }
710
-
711
- fn check_expr ( & mut self , cx : & Context , e : & ast:: Expr ) {
712
- let t = ty:: expr_ty ( cx. tcx , e) ;
713
- match ty:: get ( t) . sty {
714
- ty:: ty_uniq( t) => match ty:: get ( t) . sty {
715
- ty:: ty_vec( _, None ) => {
716
- cx. span_lint ( DEPRECATED_OWNED_VECTOR , e. span ,
717
- "use of deprecated `~[]` vector; replaced by `std::vec::Vec`" )
718
- }
719
- _ => { }
720
- } ,
721
- _ => { }
722
- }
723
- }
724
- }
725
-
726
699
declare_lint ! ( NON_CAMEL_CASE_TYPES , Warn ,
727
700
"types, variants and traits should have camel case names" )
728
701
@@ -1028,7 +1001,7 @@ impl LintPass for UnnecessaryParens {
1028
1001
ast:: ExprAssignOp ( _, _, value) => ( value, "assigned value" ) ,
1029
1002
_ => return
1030
1003
} ;
1031
- self . check_unnecessary_parens_core ( cx, value, msg) ;
1004
+ self . check_unnecessary_parens_core ( cx, & * value, msg) ;
1032
1005
}
1033
1006
1034
1007
fn check_stmt ( & mut self , cx : & Context , s : & ast:: Stmt ) {
@@ -1042,7 +1015,7 @@ impl LintPass for UnnecessaryParens {
1042
1015
} ,
1043
1016
_ => return
1044
1017
} ;
1045
- self . check_unnecessary_parens_core ( cx, value, msg) ;
1018
+ self . check_unnecessary_parens_core ( cx, & * value, msg) ;
1046
1019
}
1047
1020
}
1048
1021
@@ -1097,12 +1070,12 @@ declare_lint!(UNUSED_MUT, Warn,
1097
1070
pub struct UnusedMut ;
1098
1071
1099
1072
impl UnusedMut {
1100
- fn check_unused_mut_pat ( & self , cx : & Context , pats : & [ @ ast:: Pat ] ) {
1073
+ fn check_unused_mut_pat ( & self , cx : & Context , pats : & [ Gc < ast:: Pat > ] ) {
1101
1074
// collect all mutable pattern and group their NodeIDs by their Identifier to
1102
1075
// avoid false warnings in match arms with multiple patterns
1103
1076
let mut mutables = HashMap :: new ( ) ;
1104
1077
for & p in pats. iter ( ) {
1105
- pat_util:: pat_bindings ( & cx. tcx . def_map , p, |mode, id, _, path| {
1078
+ pat_util:: pat_bindings ( & cx. tcx . def_map , & * p, |mode, id, _, path| {
1106
1079
match mode {
1107
1080
ast:: BindByValue ( ast:: MutMutable ) => {
1108
1081
if path. segments . len ( ) != 1 {
0 commit comments