Skip to content

Commit ea68ce7

Browse files
committed
Revert a hack that only ever worked on level deep
1 parent 6b33d5b commit ea68ce7

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -967,11 +967,7 @@ pub(crate) fn compute_match_usefulness<'p, 'tcx>(
967967
})
968968
.collect();
969969

970-
// In case we're matching on an opaque type in its defining scope, the patterns define the hidden type.
971-
// The wildcard pattern needs to have the same type, otherwise it will always be deemed useful, even if the
972-
// match is exhaustive for the pattern type.
973-
let wild_ty = arms.first().map_or(scrut_ty, |arm| arm.pat.ty());
974-
let wild_pattern = cx.pattern_arena.alloc(DeconstructedPat::wildcard(wild_ty));
970+
let wild_pattern = cx.pattern_arena.alloc(DeconstructedPat::wildcard(scrut_ty));
975971
let v = PatStack::from_pattern(wild_pattern);
976972
let usefulness = is_useful(cx, &matrix, &v, FakeExtraWildcard, scrut_hir_id, false, true);
977973
let non_exhaustiveness_witnesses = match usefulness {

0 commit comments

Comments
 (0)