diff options
| author | DianQK <dianqk@dianqk.net> | 2024-03-12 22:34:02 +0800 |
|---|---|---|
| committer | DianQK <dianqk@dianqk.net> | 2024-04-08 19:20:07 +0800 |
| commit | 166bb1bd463dbf6cd3bade6a6b1434884666f032 (patch) | |
| tree | 4406c63947bbf13705b1ba2d8dc53a9a7820f211 /compiler | |
| parent | 928c57dc9ad4caf66770235aab1a6850acebd649 (diff) | |
| download | rust-166bb1bd463dbf6cd3bade6a6b1434884666f032.tar.gz rust-166bb1bd463dbf6cd3bade6a6b1434884666f032.zip | |
Don't change the otherwise of the switch
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir_transform/src/early_otherwise_branch.rs | 3 |
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 007c98217c0..9edb8bcee6e 100644 --- a/compiler/rustc_mir_transform/src/early_otherwise_branch.rs +++ b/compiler/rustc_mir_transform/src/early_otherwise_branch.rs @@ -168,7 +168,8 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch { }; (value, targets.target_for_value(value)) }); - let eq_targets = SwitchTargets::new(eq_new_targets, opt_data.destination); + // The otherwise either is the same target branch or an unreachable. + let eq_targets = SwitchTargets::new(eq_new_targets, parent_targets.otherwise()); // Create `bbEq` in example above let eq_switch = BasicBlockData::new(Some(Terminator { |
