diff options
| author | Nadrieril <nadrieril+git@gmail.com> | 2024-02-16 04:19:15 +0100 |
|---|---|---|
| committer | Nadrieril <nadrieril+git@gmail.com> | 2024-02-17 20:21:57 +0100 |
| commit | b4f0e76021f3a8bb5f264d68d744d35ef867aa1a (patch) | |
| tree | 7d359206f7c41bc3fce5f0527a7d98a445504f23 | |
| parent | 105bdf708606258a5d70e8bed4b576663bcc2672 (diff) | |
| download | rust-b4f0e76021f3a8bb5f264d68d744d35ef867aa1a.tar.gz rust-b4f0e76021f3a8bb5f264d68d744d35ef867aa1a.zip | |
It's fine to assign `otherwise_block`s to unreachable candidates
| -rw-r--r-- | compiler/rustc_mir_build/src/build/matches/mod.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/compiler/rustc_mir_build/src/build/matches/mod.rs b/compiler/rustc_mir_build/src/build/matches/mod.rs index 17f3d206232..dc04d4e0922 100644 --- a/compiler/rustc_mir_build/src/build/matches/mod.rs +++ b/compiler/rustc_mir_build/src/build/matches/mod.rs @@ -1314,24 +1314,17 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { } let mut next_prebinding = start_block; - let mut reachable = true; - for candidate in matched_candidates.iter_mut() { assert!(candidate.otherwise_block.is_none()); assert!(candidate.pre_binding_block.is_none()); candidate.pre_binding_block = Some(next_prebinding); next_prebinding = self.cfg.start_new_block(); - if reachable { - if candidate.has_guard { - // Create the otherwise block for this candidate, which is the - // pre-binding block for the next candidate. - candidate.otherwise_block = Some(next_prebinding); - } else { - reachable = false; - } + if candidate.has_guard { + // Create the otherwise block for this candidate, which is the + // pre-binding block for the next candidate. + candidate.otherwise_block = Some(next_prebinding); } } - next_prebinding } |
