@@ -39,7 +39,7 @@ use std::cmp;
3939use std:: collections:: HashMap ;
4040use std:: collections:: hash_map:: { Occupied , Vacant } ;
4141use std:: slice;
42- use std:: { int , i8, i16, i32, i64, uint , u8, u16, u32, u64, f32, f64} ;
42+ use std:: { i8, i16, i32, i64, u8, u16, u32, u64, f32, f64} ;
4343use syntax:: abi;
4444use syntax:: ast_map;
4545use syntax:: ast_util:: is_shift_binop;
@@ -180,8 +180,8 @@ impl LintPass for TypeLimits {
180180
181181 if is_shift_binop ( binop) {
182182 let opt_ty_bits = match ty:: get ( ty:: expr_ty ( cx. tcx , & * * l) ) . sty {
183- ty:: ty_int( t) => Some ( int_ty_bits ( t) ) ,
184- ty:: ty_uint( t) => Some ( uint_ty_bits ( t) ) ,
183+ ty:: ty_int( t) => Some ( int_ty_bits ( t, cx . sess ( ) . targ_cfg . int_type ) ) ,
184+ ty:: ty_uint( t) => Some ( uint_ty_bits ( t, cx . sess ( ) . targ_cfg . uint_type ) ) ,
185185 _ => None
186186 } ;
187187
@@ -312,19 +312,19 @@ impl LintPass for TypeLimits {
312312 }
313313 }
314314
315- fn int_ty_bits ( int_ty : ast:: IntTy ) -> u64 {
315+ fn int_ty_bits ( int_ty : ast:: IntTy , target_int_ty : ast :: IntTy ) -> u64 {
316316 match int_ty {
317- ast:: TyI => int :: BITS as u64 ,
317+ ast:: TyI => int_ty_bits ( target_int_ty , target_int_ty ) ,
318318 ast:: TyI8 => i8:: BITS as u64 ,
319319 ast:: TyI16 => i16:: BITS as u64 ,
320320 ast:: TyI32 => i32:: BITS as u64 ,
321321 ast:: TyI64 => i64:: BITS as u64
322322 }
323323 }
324324
325- fn uint_ty_bits ( uint_ty : ast:: UintTy ) -> u64 {
325+ fn uint_ty_bits ( uint_ty : ast:: UintTy , target_uint_ty : ast :: UintTy ) -> u64 {
326326 match uint_ty {
327- ast:: TyU => uint :: BITS as u64 ,
327+ ast:: TyU => uint_ty_bits ( target_uint_ty , target_uint_ty ) ,
328328 ast:: TyU8 => u8:: BITS as u64 ,
329329 ast:: TyU16 => u16:: BITS as u64 ,
330330 ast:: TyU32 => u32:: BITS as u64 ,
0 commit comments