@@ -622,7 +622,6 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
622622 -> Vec < Constructor < ' tcx > >
623623{
624624 debug ! ( "all_constructors({:?})" , pcx. ty) ;
625- let exhaustive_integer_patterns = cx. tcx . features ( ) . exhaustive_integer_patterns ;
626625 let ctors = match pcx. ty . sty {
627626 ty:: Bool => {
628627 [ true , false ] . iter ( ) . map ( |& b| {
@@ -652,7 +651,7 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
652651 . map ( |v| Variant ( v. did ) )
653652 . collect ( )
654653 }
655- ty:: Char if exhaustive_integer_patterns => {
654+ ty:: Char => {
656655 vec ! [
657656 // The valid Unicode Scalar Value ranges.
658657 ConstantRange ( '\u{0000}' as u128 ,
@@ -667,14 +666,14 @@ fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
667666 ) ,
668667 ]
669668 }
670- ty:: Int ( ity) if exhaustive_integer_patterns => {
669+ ty:: Int ( ity) => {
671670 // FIXME(49937): refactor these bit manipulations into interpret.
672671 let bits = Integer :: from_attr ( & cx. tcx , SignedInt ( ity) ) . size ( ) . bits ( ) as u128 ;
673672 let min = 1u128 << ( bits - 1 ) ;
674673 let max = ( 1u128 << ( bits - 1 ) ) - 1 ;
675674 vec ! [ ConstantRange ( min, max, pcx. ty, RangeEnd :: Included ) ]
676675 }
677- ty:: Uint ( uty) if exhaustive_integer_patterns => {
676+ ty:: Uint ( uty) => {
678677 // FIXME(49937): refactor these bit manipulations into interpret.
679678 let bits = Integer :: from_attr ( & cx. tcx , UnsignedInt ( uty) ) . size ( ) . bits ( ) as u128 ;
680679 let max = !0u128 >> ( 128 - bits) ;
@@ -971,12 +970,10 @@ fn compute_missing_ctors<'a, 'tcx: 'a>(
971970 // If a constructor appears in a `match` arm, we can
972971 // eliminate it straight away.
973972 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) ;
980977 }
981978
982979 // If the constructor patterns that have been considered so far
@@ -1433,17 +1430,16 @@ fn slice_pat_covered_by_constructor<'tcx>(
14331430// Whether to evaluate a constructor using exhaustive integer matching. This is true if the
14341431// constructor is a range or constant with an integer type.
14351432fn 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
14451442 }
1446- false
14471443}
14481444
14491445/// For exhaustive integer matching, some constructors are grouped within other constructors
0 commit comments