@@ -622,7 +622,6 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
622
622
-> Vec < Constructor < ' tcx > >
623
623
{
624
624
debug ! ( "all_constructors({:?})" , pcx. ty) ;
625
- let exhaustive_integer_patterns = cx. tcx . features ( ) . exhaustive_integer_patterns ;
626
625
let ctors = match pcx. ty . sty {
627
626
ty:: Bool => {
628
627
[ true , false ] . iter ( ) . map ( |& b| {
@@ -652,7 +651,7 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
652
651
. map ( |v| Variant ( v. did ) )
653
652
. collect ( )
654
653
}
655
- ty:: Char if exhaustive_integer_patterns => {
654
+ ty:: Char => {
656
655
vec ! [
657
656
// The valid Unicode Scalar Value ranges.
658
657
ConstantRange ( '\u{0000}' as u128 ,
@@ -667,14 +666,14 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
667
666
) ,
668
667
]
669
668
}
670
- ty:: Int ( ity) if exhaustive_integer_patterns => {
669
+ ty:: Int ( ity) => {
671
670
// FIXME(49937): refactor these bit manipulations into interpret.
672
671
let bits = Integer :: from_attr ( & cx. tcx , SignedInt ( ity) ) . size ( ) . bits ( ) as u128 ;
673
672
let min = 1u128 << ( bits - 1 ) ;
674
673
let max = ( 1u128 << ( bits - 1 ) ) - 1 ;
675
674
vec ! [ ConstantRange ( min, max, pcx. ty, RangeEnd :: Included ) ]
676
675
}
677
- ty:: Uint ( uty) if exhaustive_integer_patterns => {
676
+ ty:: Uint ( uty) => {
678
677
// FIXME(49937): refactor these bit manipulations into interpret.
679
678
let bits = Integer :: from_attr ( & cx. tcx , UnsignedInt ( uty) ) . size ( ) . bits ( ) as u128 ;
680
679
let max = !0u128 >> ( 128 - bits) ;
@@ -971,12 +970,10 @@ fn compute_missing_ctors<'a, 'tcx: 'a>(
971
970
// If a constructor appears in a `match` arm, we can
972
971
// eliminate it straight away.
973
972
refined_ctors = vec ! [ ]
974
- } else if tcx. features ( ) . exhaustive_integer_patterns {
975
- if let Some ( interval) = IntRange :: from_ctor ( tcx, used_ctor) {
976
- // Refine the required constructors for the type by subtracting
977
- // the range defined by the current constructor pattern.
978
- refined_ctors = interval. subtract_from ( tcx, refined_ctors) ;
979
- }
973
+ } else if let Some ( interval) = IntRange :: from_ctor ( tcx, used_ctor) {
974
+ // Refine the required constructors for the type by subtracting
975
+ // the range defined by the current constructor pattern.
976
+ refined_ctors = interval. subtract_from ( tcx, refined_ctors) ;
980
977
}
981
978
982
979
// If the constructor patterns that have been considered so far
@@ -1433,17 +1430,16 @@ fn slice_pat_covered_by_constructor<'tcx>(
1433
1430
// Whether to evaluate a constructor using exhaustive integer matching. This is true if the
1434
1431
// constructor is a range or constant with an integer type.
1435
1432
fn should_treat_range_exhaustively ( tcx : TyCtxt < ' _ , ' tcx , ' tcx > , ctor : & Constructor < ' tcx > ) -> bool {
1436
- if tcx . features ( ) . exhaustive_integer_patterns {
1437
- let ty = match ctor {
1438
- ConstantValue ( value ) => value . ty ,
1439
- ConstantRange ( _ , _ , ty , _ ) => ty ,
1440
- _ => return false ,
1441
- } ;
1442
- if let ty :: Char | ty :: Int ( _ ) | ty :: Uint ( _ ) = ty . sty {
1443
- return true ;
1444
- }
1433
+ let ty = match ctor {
1434
+ ConstantValue ( value ) => value . ty ,
1435
+ ConstantRange ( _ , _ , ty , _ ) => ty,
1436
+ _ => return false ,
1437
+ } ;
1438
+ if let ty :: Char | ty :: Int ( _ ) | ty :: Uint ( _ ) = ty . sty {
1439
+ true
1440
+ } else {
1441
+ false
1445
1442
}
1446
- false
1447
1443
}
1448
1444
1449
1445
/// For exhaustive integer matching, some constructors are grouped within other constructors
0 commit comments