Skip to content

Commit 9d2c923

Browse files
committed
Fix SwitchTarget pretty print
We currently rely on the order of successors to be conditional branches first, followed by the otherwise target.
1 parent 3e0b2fa commit 9d2c923

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

compiler/stable_mir/src/mir/body.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,7 @@ pub struct SwitchTargets {
672672
impl SwitchTargets {
673673
/// All possible targets including the `otherwise` target.
674674
pub fn all_targets(&self) -> Successors {
675-
Some(self.otherwise)
676-
.into_iter()
677-
.chain(self.branches.iter().map(|(_, target)| *target))
678-
.collect()
675+
self.branches.iter().map(|(_, target)| *target).chain(Some(self.otherwise)).collect()
679676
}
680677

681678
/// The `otherwise` branch target.

0 commit comments

Comments
 (0)