@@ -45,6 +45,7 @@ use std::u16;
4545use std:: u32;
4646use std:: u64;
4747use std:: u8;
48+ use std:: gc:: Gc ;
4849use syntax:: abi;
4950use syntax:: ast_map;
5051use syntax:: attr:: AttrMetaMethods ;
@@ -98,8 +99,8 @@ impl LintPass for UnusedCasts {
9899 fn check_expr ( & mut self , cx : & Context , e : & ast:: Expr ) {
99100 match e. node {
100101 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 {
103104 cx. span_lint ( UNNECESSARY_TYPECAST , ty. span , "unnecessary type cast" ) ;
104105 }
105106 }
@@ -150,7 +151,7 @@ impl LintPass for TypeLimits {
150151 }
151152 } ,
152153 _ => {
153- let t = ty:: expr_ty ( cx. tcx , expr) ;
154+ let t = ty:: expr_ty ( cx. tcx , & * expr) ;
154155 match ty:: get ( t) . sty {
155156 ty:: ty_uint( _) => {
156157 cx. span_lint ( UNSIGNED_NEGATE , e. span ,
@@ -170,7 +171,7 @@ impl LintPass for TypeLimits {
170171 self . negated_expr_id = expr. id ;
171172 } ,
172173 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) {
174175 cx. span_lint ( TYPE_LIMITS , e. span ,
175176 "comparison is useless due to type limits" ) ;
176177 }
@@ -202,6 +203,7 @@ impl LintPass for TypeLimits {
202203 } else { t } ;
203204 let ( min, max) = uint_ty_range ( uint_type) ;
204205 let lit_val: u64 = match lit. node {
206+ ast:: LitByte ( _v) => return , // _v is u8, within range by definition
205207 ast:: LitInt ( v, _) => v as u64 ,
206208 ast:: LitUint ( v, _) => v,
207209 ast:: LitIntUnsuffixed ( v) => v as u64 ,
@@ -350,24 +352,24 @@ impl LintPass for CTypes {
350352 _ => ( )
351353 }
352354 }
353- ast:: TyPtr ( ref mt) => { check_ty ( cx, mt. ty ) }
355+ ast:: TyPtr ( ref mt) => { check_ty ( cx, & * mt. ty ) }
354356 _ => { }
355357 }
356358 }
357359
358360 fn check_foreign_fn ( cx : & Context , decl : & ast:: FnDecl ) {
359361 for input in decl. inputs . iter ( ) {
360- check_ty ( cx, input. ty ) ;
362+ check_ty ( cx, & * input. ty ) ;
361363 }
362- check_ty ( cx, decl. output )
364+ check_ty ( cx, & * decl. output )
363365 }
364366
365367 match it. node {
366368 ast:: ItemForeignMod ( ref nmod) if nmod. abi != abi:: RustIntrinsic => {
367369 for ni in nmod. items . iter ( ) {
368370 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)
371373 }
372374 }
373375 }
@@ -397,9 +399,6 @@ impl HeapMemory {
397399 n_box += 1 ;
398400 }
399401 ty:: ty_uniq( _) |
400- ty:: ty_trait( box ty:: TyTrait {
401- store : ty:: UniqTraitStore , ..
402- } ) |
403402 ty:: ty_closure( box ty:: ClosureTy {
404403 store : ty:: UniqTraitStore ,
405404 ..
@@ -523,7 +522,7 @@ impl LintPass for RawPointerDeriving {
523522 match item. node {
524523 ast:: ItemStruct ( ..) | ast:: ItemEnum ( ..) => {
525524 let mut visitor = RawPtrDerivingVisitor { cx : cx } ;
526- visit:: walk_item ( & mut visitor, item, ( ) ) ;
525+ visit:: walk_item ( & mut visitor, & * item, ( ) ) ;
527526 }
528527 _ => { }
529528 }
@@ -547,7 +546,6 @@ impl LintPass for UnusedAttribute {
547546
548547 // FIXME: #14406 these are processed in trans, which happens after the
549548 // lint pass
550- "address_insignificant" ,
551549 "cold" ,
552550 "inline" ,
553551 "link" ,
@@ -653,7 +651,7 @@ impl LintPass for UnusedResult {
653651 ast:: StmtSemi ( expr, _) => expr,
654652 _ => return
655653 } ;
656- let t = ty:: expr_ty ( cx. tcx , expr) ;
654+ let t = ty:: expr_ty ( cx. tcx , & * expr) ;
657655 match ty:: get ( t) . sty {
658656 ty:: ty_nil | ty:: ty_bot | ty:: ty_bool => return ,
659657 _ => { }
@@ -663,7 +661,7 @@ impl LintPass for UnusedResult {
663661 _ => { }
664662 }
665663
666- let t = ty:: expr_ty ( cx. tcx , expr) ;
664+ let t = ty:: expr_ty ( cx. tcx , & * expr) ;
667665 let mut warned = false ;
668666 match ty:: get ( t) . sty {
669667 ty:: ty_struct( did, _) |
@@ -698,31 +696,6 @@ impl LintPass for UnusedResult {
698696 }
699697}
700698
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-
726699declare_lint ! ( NON_CAMEL_CASE_TYPES , Warn ,
727700 "types, variants and traits should have camel case names" )
728701
@@ -1028,7 +1001,7 @@ impl LintPass for UnnecessaryParens {
10281001 ast:: ExprAssignOp ( _, _, value) => ( value, "assigned value" ) ,
10291002 _ => return
10301003 } ;
1031- self . check_unnecessary_parens_core ( cx, value, msg) ;
1004+ self . check_unnecessary_parens_core ( cx, & * value, msg) ;
10321005 }
10331006
10341007 fn check_stmt ( & mut self , cx : & Context , s : & ast:: Stmt ) {
@@ -1042,7 +1015,7 @@ impl LintPass for UnnecessaryParens {
10421015 } ,
10431016 _ => return
10441017 } ;
1045- self . check_unnecessary_parens_core ( cx, value, msg) ;
1018+ self . check_unnecessary_parens_core ( cx, & * value, msg) ;
10461019 }
10471020}
10481021
@@ -1097,12 +1070,12 @@ declare_lint!(UNUSED_MUT, Warn,
10971070pub struct UnusedMut ;
10981071
10991072impl 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 > ] ) {
11011074 // collect all mutable pattern and group their NodeIDs by their Identifier to
11021075 // avoid false warnings in match arms with multiple patterns
11031076 let mut mutables = HashMap :: new ( ) ;
11041077 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| {
11061079 match mode {
11071080 ast:: BindByValue ( ast:: MutMutable ) => {
11081081 if path. segments . len ( ) != 1 {
0 commit comments