Skip to content

Commit 51ada89

Browse files
committed
Match min_exhaustive_patterns implementation with exhaustive_patterns
1 parent 586893c commit 51ada89

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_mir_build/src/build/matches/simplify.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
271271
PatKind::Variant { adt_def, args, variant_index, ref subpatterns } => {
272272
let irrefutable = adt_def.variants().iter_enumerated().all(|(i, v)| {
273273
i == variant_index || {
274-
self.tcx.features().exhaustive_patterns
274+
(self.tcx.features().exhaustive_patterns
275+
|| self.tcx.features().min_exhaustive_patterns)
275276
&& !v
276277
.inhabited_predicate(self.tcx, adt_def)
277278
.instantiate(self.tcx, args)

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
665665

666666
// Emit an extra note if the first uncovered witness would be uninhabited
667667
// if we disregard visibility.
668-
let witness_1_is_privately_uninhabited = if self.tcx.features().exhaustive_patterns
668+
let witness_1_is_privately_uninhabited = if (self.tcx.features().exhaustive_patterns
669+
|| self.tcx.features().min_exhaustive_patterns)
669670
&& let Some(witness_1) = witnesses.get(0)
670671
&& let ty::Adt(adt, args) = witness_1.ty().kind()
671672
&& adt.is_enum()

0 commit comments

Comments
 (0)