@@ -104,7 +104,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
104
104
report_bin_hex_error (
105
105
cx,
106
106
e,
107
- ty :: Int ( t) ,
107
+ attr :: IntType :: SignedInt ( t) ,
108
108
repr_str,
109
109
v,
110
110
negative,
@@ -159,7 +159,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
159
159
report_bin_hex_error (
160
160
cx,
161
161
e,
162
- ty :: Uint ( t) ,
162
+ attr :: IntType :: UnsignedInt ( t) ,
163
163
repr_str,
164
164
lit_val,
165
165
false ,
@@ -364,29 +364,24 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
364
364
}
365
365
}
366
366
367
- #[ cfg_attr( not( stage0) , allow( usage_of_ty_tykind) ) ]
368
367
fn report_bin_hex_error (
369
368
cx : & LateContext < ' _ , ' _ > ,
370
369
expr : & hir:: Expr ,
371
- ty : ty :: TyKind < ' _ > ,
370
+ ty : attr :: IntType ,
372
371
repr_str : String ,
373
372
val : u128 ,
374
373
negative : bool ,
375
374
) {
375
+ let size = layout:: Integer :: from_attr ( & cx. tcx , ty) . size ( ) ;
376
376
let ( t, actually) = match ty {
377
- ty:: Int ( t) => {
378
- let ity = attr:: IntType :: SignedInt ( t) ;
379
- let size = layout:: Integer :: from_attr ( & cx. tcx , ity) . size ( ) ;
377
+ attr:: IntType :: SignedInt ( t) => {
380
378
let actually = sign_extend ( val, size) as i128 ;
381
379
( format ! ( "{:?}" , t) , actually. to_string ( ) )
382
380
}
383
- ty:: Uint ( t) => {
384
- let ity = attr:: IntType :: UnsignedInt ( t) ;
385
- let size = layout:: Integer :: from_attr ( & cx. tcx , ity) . size ( ) ;
381
+ attr:: IntType :: UnsignedInt ( t) => {
386
382
let actually = truncate ( val, size) ;
387
383
( format ! ( "{:?}" , t) , actually. to_string ( ) )
388
384
}
389
- _ => bug ! ( ) ,
390
385
} ;
391
386
let mut err = cx. struct_span_lint (
392
387
OVERFLOWING_LITERALS ,
0 commit comments