@@ -39,7 +39,7 @@ use std::cmp;
39
39
use std:: collections:: HashMap ;
40
40
use std:: collections:: hash_map:: { Occupied , Vacant } ;
41
41
use 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} ;
43
43
use syntax:: abi;
44
44
use syntax:: ast_map;
45
45
use syntax:: ast_util:: is_shift_binop;
@@ -180,8 +180,8 @@ impl LintPass for TypeLimits {
180
180
181
181
if is_shift_binop ( binop) {
182
182
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 ) ) ,
185
185
_ => None
186
186
} ;
187
187
@@ -312,19 +312,19 @@ impl LintPass for TypeLimits {
312
312
}
313
313
}
314
314
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 {
316
316
match int_ty {
317
- ast:: TyI => int :: BITS as u64 ,
317
+ ast:: TyI => int_ty_bits ( target_int_ty , target_int_ty ) ,
318
318
ast:: TyI8 => i8:: BITS as u64 ,
319
319
ast:: TyI16 => i16:: BITS as u64 ,
320
320
ast:: TyI32 => i32:: BITS as u64 ,
321
321
ast:: TyI64 => i64:: BITS as u64
322
322
}
323
323
}
324
324
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 {
326
326
match uint_ty {
327
- ast:: TyU => uint :: BITS as u64 ,
327
+ ast:: TyU => uint_ty_bits ( target_uint_ty , target_uint_ty ) ,
328
328
ast:: TyU8 => u8:: BITS as u64 ,
329
329
ast:: TyU16 => u16:: BITS as u64 ,
330
330
ast:: TyU32 => u32:: BITS as u64 ,
0 commit comments