about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
diff options
context:
space:
mode:
authorDianQK <dianqk@dianqk.net>2024-09-24 22:51:36 +0800
committerDianQK <dianqk@dianqk.net>2024-12-18 20:43:54 +0800
commit15fa788cc3968d3ee3d41282bcdc1d2542f35859 (patch)
tree1a38e556790870468103593fb1eb825e4c362703 /compiler/rustc_mir_transform
parent7a0b78da910a99ef07e88fb4dcc41af2367db2bd (diff)
downloadrust-15fa788cc3968d3ee3d41282bcdc1d2542f35859.tar.gz
rust-15fa788cc3968d3ee3d41282bcdc1d2542f35859.zip
mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB
Diffstat (limited to 'compiler/rustc_mir_transform')
-rw-r--r--compiler/rustc_mir_transform/src/early_otherwise_branch.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
index 2f2d07c739c..be6056250fd 100644
--- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
+++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs
@@ -179,7 +179,7 @@ impl<'tcx> crate::MirPass<'tcx> for EarlyOtherwiseBranch {
             let eq_targets = SwitchTargets::new(eq_new_targets, parent_targets.otherwise());
 
             // Create `bbEq` in example above
-            let eq_switch = BasicBlockData::new(Some(Terminator {
+            let mut eq_switch = BasicBlockData::new(Some(Terminator {
                 source_info: bbs[parent].terminator().source_info,
                 kind: TerminatorKind::SwitchInt {
                     // switch on the first discriminant, so we can mark the second one as dead
@@ -187,6 +187,7 @@ impl<'tcx> crate::MirPass<'tcx> for EarlyOtherwiseBranch {
                     targets: eq_targets,
                 },
             }));
+            eq_switch.is_cleanup = bbs[parent].is_cleanup;
 
             let eq_bb = patch.new_block(eq_switch);