diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-06-28 08:00:25 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-07-15 15:56:17 +0000 |
| commit | ea68ce7fac0a5888e54e5725066b04fcd4290efa (patch) | |
| tree | 86c175376515be6945655e9cfab8f7f3520392f0 | |
| parent | 6b33d5bfa94f0005c2ae7136f4cda14a396e42bc (diff) | |
| download | rust-ea68ce7fac0a5888e54e5725066b04fcd4290efa.tar.gz rust-ea68ce7fac0a5888e54e5725066b04fcd4290efa.zip | |
Revert a hack that only ever worked on level deep
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/usefulness.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs index 3203f801fa0..9e7a267ecbd 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs @@ -967,11 +967,7 @@ pub(crate) fn compute_match_usefulness<'p, 'tcx>( }) .collect(); - // In case we're matching on an opaque type in its defining scope, the patterns define the hidden type. - // The wildcard pattern needs to have the same type, otherwise it will always be deemed useful, even if the - // match is exhaustive for the pattern type. - let wild_ty = arms.first().map_or(scrut_ty, |arm| arm.pat.ty()); - let wild_pattern = cx.pattern_arena.alloc(DeconstructedPat::wildcard(wild_ty)); + let wild_pattern = cx.pattern_arena.alloc(DeconstructedPat::wildcard(scrut_ty)); let v = PatStack::from_pattern(wild_pattern); let usefulness = is_useful(cx, &matrix, &v, FakeExtraWildcard, scrut_hir_id, false, true); let non_exhaustiveness_witnesses = match usefulness { |
