diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2022-10-04 09:22:39 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2022-10-22 13:20:06 -0500 |
| commit | 2928e9ef2c75e2a654c0bf5afce3762cbb24eb94 (patch) | |
| tree | d86cb54c52ff46bd41d5205717a0d03ce5f7763e /compiler/rustc_mir_build/src/thir | |
| parent | 0940040c0486a536be4f8685c7dd9a078f9e87c2 (diff) | |
| download | rust-2928e9ef2c75e2a654c0bf5afce3762cbb24eb94.tar.gz rust-2928e9ef2c75e2a654c0bf5afce3762cbb24eb94.zip | |
Introduce InhabitedPredicate
Diffstat (limited to 'compiler/rustc_mir_build/src/thir')
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs index 91ecfccdb5f..595abc8f668 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs @@ -988,10 +988,12 @@ impl<'tcx> SplitWildcard<'tcx> { .filter(|(_, v)| { // If `exhaustive_patterns` is enabled, we exclude variants known to be // uninhabited. - let is_uninhabited = is_exhaustive_pat_feature - && v.uninhabited_from(cx.tcx, substs, def.adt_kind(), cx.param_env) - .contains(cx.tcx, cx.module); - !is_uninhabited + !is_exhaustive_pat_feature + || v.inhabited_predicate(cx.tcx, *def).subst(cx.tcx, substs).apply( + cx.tcx, + cx.param_env, + cx.module, + ) }) .map(|(idx, _)| Variant(idx)) .collect(); |
