diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-08-14 05:05:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-14 05:05:53 +0200 |
| commit | e01d6141a403af503c963794f8758ff49f057f84 (patch) | |
| tree | f1d7d7e0bebf398aa1831b34abba449f74fa401b /compiler | |
| parent | cd6852b9ea778125607560b332ba1152a6ef1980 (diff) | |
| parent | 249a588cadc31b78cb6e57017a2a86f861648638 (diff) | |
| download | rust-e01d6141a403af503c963794f8758ff49f057f84.tar.gz rust-e01d6141a403af503c963794f8758ff49f057f84.zip | |
Rollup merge of #129062 - Nadrieril:fix-129009, r=compiler-errors
Remove a no-longer-true assert Fixes https://github.com/rust-lang/rust/issues/129009 The assert was simply no longer true. I thought my test suite was thorough but I had not noticed these `let`-specific diagnostics codepaths. r? `@compiler-errors`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir_build/src/thir/pattern/check_match.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 07bf222fcca..85b9dacb129 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -702,10 +702,12 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> { && adt.is_enum() && let Constructor::Variant(variant_index) = witness_1.ctor() { - let variant = adt.variant(*variant_index); - let inhabited = variant.inhabited_predicate(self.tcx, *adt).instantiate(self.tcx, args); - assert!(inhabited.apply(self.tcx, cx.param_env, cx.module)); - !inhabited.apply_ignore_module(self.tcx, cx.param_env) + let variant_inhabited = adt + .variant(*variant_index) + .inhabited_predicate(self.tcx, *adt) + .instantiate(self.tcx, args); + variant_inhabited.apply(self.tcx, cx.param_env, cx.module) + && !variant_inhabited.apply_ignore_module(self.tcx, cx.param_env) } else { false }; |
