@@ -368,8 +368,6 @@ pub(super) struct PatCtxt<'a, 'p, 'tcx> {
368
368
/// Whether the current pattern is the whole pattern as found in a match arm, or if it's a
369
369
/// subpattern.
370
370
pub ( super ) is_top_level : bool ,
371
- /// Whether the current pattern is from a `non_exhaustive` enum.
372
- pub ( super ) is_non_exhaustive : bool ,
373
371
}
374
372
375
373
impl < ' a , ' p , ' tcx > fmt:: Debug for PatCtxt < ' a , ' p , ' tcx > {
@@ -826,9 +824,8 @@ fn is_useful<'p, 'tcx>(
826
824
ty = row. head ( ) . ty ( ) ;
827
825
}
828
826
}
829
- let is_non_exhaustive = cx. is_foreign_non_exhaustive_enum ( ty) ;
830
827
debug ! ( "v.head: {:?}, v.span: {:?}" , v. head( ) , v. head( ) . span( ) ) ;
831
- let pcx = & PatCtxt { cx, ty, span : v. head ( ) . span ( ) , is_top_level, is_non_exhaustive } ;
828
+ let pcx = & PatCtxt { cx, ty, span : v. head ( ) . span ( ) , is_top_level } ;
832
829
833
830
let v_ctor = v. head ( ) . ctor ( ) ;
834
831
debug ! ( ?v_ctor) ;
@@ -843,7 +840,8 @@ fn is_useful<'p, 'tcx>(
843
840
}
844
841
// We split the head constructor of `v`.
845
842
let split_ctors = v_ctor. split ( pcx, matrix. heads ( ) . map ( DeconstructedPat :: ctor) ) ;
846
- let is_non_exhaustive_and_wild = is_non_exhaustive && v_ctor. is_wildcard ( ) ;
843
+ let is_non_exhaustive_and_wild =
844
+ cx. is_foreign_non_exhaustive_enum ( ty) && v_ctor. is_wildcard ( ) ;
847
845
// For each constructor, we compute whether there's a value that starts with it that would
848
846
// witness the usefulness of `v`.
849
847
let start_matrix = & matrix;
0 commit comments