@@ -273,7 +273,7 @@ impl<'tcx> Constructor<'tcx> {
273
273
}
274
274
}
275
275
276
- #[ derive( Clone , Debug ) ]
276
+ #[ derive( Clone ) ]
277
277
pub enum Usefulness < ' tcx > {
278
278
Useful ,
279
279
UsefulWithWitness ( Vec < Witness < ' tcx > > ) ,
@@ -468,13 +468,18 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
468
468
}
469
469
ty:: TyInt ( int_ty) if exhaustive_integer_patterns => {
470
470
use syntax:: ast:: IntTy :: * ;
471
+ macro_rules! min_max_ty {
472
+ ( $ity: ident, $uty: ty, $sty: expr) => {
473
+ ( $ity:: MIN as $uty as u128 , $ity:: MAX as $uty as u128 , $sty)
474
+ }
475
+ }
471
476
let ( min, max, ty) = match int_ty {
472
- Isize => ( isize:: MIN as usize as u128 , isize :: MAX as usize as u128 , cx. tcx . types . isize ) ,
473
- I8 => ( i8 :: MIN as u8 as u128 , i8 :: MAX as u8 as u128 , cx. tcx . types . i8 ) ,
474
- I16 => ( i16:: MIN as u16 as u128 , i16 :: MAX as u16 as u128 , cx. tcx . types . i16 ) ,
475
- I32 => ( i32:: MIN as u32 as u128 , i32 :: MAX as u32 as u128 , cx. tcx . types . i32 ) ,
476
- I64 => ( i64:: MIN as u64 as u128 , i64 :: MAX as u64 as u128 , cx. tcx . types . i64 ) ,
477
- I128 => ( i128:: MIN as u128 as u128 , i128 :: MAX as u128 as u128 , cx. tcx . types . i128 ) ,
477
+ Isize => min_max_ty ! ( isize , usize , cx. tcx. types. isize ) ,
478
+ I8 => min_max_ty ! ( i8 , u8 , cx. tcx. types. i8 ) ,
479
+ I16 => min_max_ty ! ( i16 , u16 , cx. tcx. types. i16 ) ,
480
+ I32 => min_max_ty ! ( i32 , u32 , cx. tcx. types. i32 ) ,
481
+ I64 => min_max_ty ! ( i64 , u64 , cx. tcx. types. i64 ) ,
482
+ I128 => min_max_ty ! ( i128 , u128 , cx. tcx. types. i128 ) ,
478
483
} ;
479
484
value_constructors = true ;
480
485
vec ! [ ConstantRange ( ty:: Const :: from_bits( cx. tcx, min, ty) ,
@@ -653,8 +658,8 @@ impl<'tcx> Interval<'tcx> {
653
658
match ty. sty {
654
659
ty:: TyInt ( int_ty) => {
655
660
macro_rules! offset_sign_for_ty {
656
- ( $ity: ty , $uty: ty, $min : expr ) => { {
657
- let min = Wrapping ( $min as $uty) ;
661
+ ( $ity: ident , $uty: ty) => { {
662
+ let min = Wrapping ( $ity :: MIN as $uty) ;
658
663
if forwards {
659
664
( ( Wrapping ( lo as $uty) + min) . 0 as u128 ,
660
665
( Wrapping ( hi as $uty) + min) . 0 as u128 )
@@ -665,12 +670,12 @@ impl<'tcx> Interval<'tcx> {
665
670
} }
666
671
}
667
672
match int_ty {
668
- Isize => offset_sign_for_ty ! ( isize , usize , isize :: MIN ) ,
669
- I8 => offset_sign_for_ty ! ( i8 , u8 , i8 :: MIN ) ,
670
- I16 => offset_sign_for_ty ! ( i16 , u16 , i16 :: MIN ) ,
671
- I32 => offset_sign_for_ty ! ( i32 , u32 , i32 :: MIN ) ,
672
- I64 => offset_sign_for_ty ! ( i64 , u64 , i64 :: MIN ) ,
673
- I128 => offset_sign_for_ty ! ( i128 , u128 , i128 :: MIN ) ,
673
+ Isize => offset_sign_for_ty ! ( isize , usize ) ,
674
+ I8 => offset_sign_for_ty ! ( i8 , u8 ) ,
675
+ I16 => offset_sign_for_ty ! ( i16 , u16 ) ,
676
+ I32 => offset_sign_for_ty ! ( i32 , u32 ) ,
677
+ I64 => offset_sign_for_ty ! ( i64 , u64 ) ,
678
+ I128 => offset_sign_for_ty ! ( i128 , u128 ) ,
674
679
}
675
680
}
676
681
ty:: TyUint ( _) | ty:: TyChar => {
0 commit comments