Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 9b032f5

Browse files
committed
pcx.is_non_exhaustive no longer used
1 parent f3ef3e2 commit 9b032f5

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

compiler/rustc_mir_build/src/thir/pattern/usefulness.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,6 @@ pub(super) struct PatCtxt<'a, 'p, 'tcx> {
368368
/// Whether the current pattern is the whole pattern as found in a match arm, or if it's a
369369
/// subpattern.
370370
pub(super) is_top_level: bool,
371-
/// Whether the current pattern is from a `non_exhaustive` enum.
372-
pub(super) is_non_exhaustive: bool,
373371
}
374372

375373
impl<'a, 'p, 'tcx> fmt::Debug for PatCtxt<'a, 'p, 'tcx> {
@@ -826,9 +824,8 @@ fn is_useful<'p, 'tcx>(
826824
ty = row.head().ty();
827825
}
828826
}
829-
let is_non_exhaustive = cx.is_foreign_non_exhaustive_enum(ty);
830827
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 };
832829

833830
let v_ctor = v.head().ctor();
834831
debug!(?v_ctor);
@@ -843,7 +840,8 @@ fn is_useful<'p, 'tcx>(
843840
}
844841
// We split the head constructor of `v`.
845842
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();
847845
// For each constructor, we compute whether there's a value that starts with it that would
848846
// witness the usefulness of `v`.
849847
let start_matrix = &matrix;

0 commit comments

Comments
 (0)