about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCelina G. Val <celinval@amazon.com>2023-11-30 11:40:55 -0800
committerCelina G. Val <celinval@amazon.com>2023-11-30 11:45:34 -0800
commit9d2c92377d1bf4d8b408b57b681bb6a04eb153a6 (patch)
tree85d29794c2a70e82a224ca47478f081d85a56a1e
parent3e0b2fac5dd02378d8a5fe2c8b0c6affed404db0 (diff)
downloadrust-9d2c92377d1bf4d8b408b57b681bb6a04eb153a6.tar.gz
rust-9d2c92377d1bf4d8b408b57b681bb6a04eb153a6.zip
Fix SwitchTarget pretty print
We currently rely on the order of successors to be conditional branches
first, followed by the otherwise target.
-rw-r--r--compiler/stable_mir/src/mir/body.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/stable_mir/src/mir/body.rs b/compiler/stable_mir/src/mir/body.rs
index 8ccc6732a8d..3a4f4283562 100644
--- a/compiler/stable_mir/src/mir/body.rs
+++ b/compiler/stable_mir/src/mir/body.rs
@@ -672,10 +672,7 @@ pub struct SwitchTargets {
 impl SwitchTargets {
     /// All possible targets including the `otherwise` target.
     pub fn all_targets(&self) -> Successors {
-        Some(self.otherwise)
-            .into_iter()
-            .chain(self.branches.iter().map(|(_, target)| *target))
-            .collect()
+        self.branches.iter().map(|(_, target)| *target).chain(Some(self.otherwise)).collect()
     }
 
     /// The `otherwise` branch target.