@@ -1047,7 +1047,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
10471047
10481048 if let Some ( constructors) = pat_constructors ( cx, v[ 0 ] , pcx) {
10491049 debug ! ( "is_useful - expanding constructors: {:#?}" , constructors) ;
1050- split_grouped_constructors ( cx. tcx , constructors, matrix, v , pcx. ty ) . into_iter ( ) . map ( |c|
1050+ split_grouped_constructors ( cx. tcx , constructors, matrix, pcx. ty ) . into_iter ( ) . map ( |c|
10511051 is_useful_specialized ( cx, matrix, v, c. clone ( ) , pcx. ty , witness)
10521052 ) . find ( |result| result. is_useful ( ) ) . unwrap_or ( NotUseful )
10531053 } else {
@@ -1095,7 +1095,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
10951095 let is_non_exhaustive = is_privately_empty || is_declared_nonexhaustive;
10961096
10971097 if missing_ctors. is_empty ( ) && !is_non_exhaustive {
1098- split_grouped_constructors ( cx. tcx , all_ctors, matrix, v , pcx. ty ) . into_iter ( ) . map ( |c| {
1098+ split_grouped_constructors ( cx. tcx , all_ctors, matrix, pcx. ty ) . into_iter ( ) . map ( |c| {
10991099 is_useful_specialized ( cx, matrix, v, c. clone ( ) , pcx. ty , witness)
11001100 } ) . find ( |result| result. is_useful ( ) ) . unwrap_or ( NotUseful )
11011101 } else {
@@ -1411,11 +1411,8 @@ fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>(
14111411 tcx : TyCtxt < ' a , ' tcx , ' tcx > ,
14121412 ctors : Vec < Constructor < ' tcx > > ,
14131413 & Matrix ( ref m) : & Matrix < ' p , ' tcx > ,
1414- p : & [ & ' p Pattern < ' tcx > ] ,
14151414 ty : Ty < ' tcx > ,
14161415) -> Vec < Constructor < ' tcx > > {
1417- let pat = & p[ 0 ] ;
1418-
14191416 let mut split_ctors = Vec :: with_capacity ( ctors. len ( ) ) ;
14201417
14211418 for ctor in ctors. into_iter ( ) {
@@ -1427,27 +1424,8 @@ fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>(
14271424 // of the new pattern `p_({m + 1},1)` (here `pat`) and the constructor range.
14281425 // Anything else is irrelevant, because it is guaranteed to result in `NotUseful`,
14291426 // which is the default case anyway, and can be ignored.
1430- let mut ctor_range = IntRange :: from_ctor ( tcx, & ctor) . unwrap ( ) ;
1431- if let Some ( pat_range) = IntRange :: from_pat ( tcx, pat) {
1432- if let Some ( new_range) = ctor_range. intersection ( & pat_range) {
1433- ctor_range = new_range;
1434- } else {
1435- // If the intersection between `pat` and the constructor is empty, the
1436- // entire range is `NotUseful`.
1437- continue ;
1438- }
1439- } else {
1440- match pat. kind {
1441- box PatternKind :: Wild => {
1442- // A wild pattern matches the entire range of values,
1443- // so the current values are fine.
1444- }
1445- // If the pattern is not a value (i.e. a degenerate range), a range or a
1446- // wildcard (which stands for the entire range), then it's guaranteed to
1447- // be `NotUseful`.
1448- _ => continue ,
1449- }
1450- }
1427+ let ctor_range = IntRange :: from_ctor ( tcx, & ctor) . unwrap ( ) ;
1428+
14511429 // We're going to collect all the endpoints in the new pattern so we can create
14521430 // subranges between them.
14531431 // If there's a single point, we need to identify it as belonging
0 commit comments