1 - // MIR for `identity` before SeparateConstSwitch
2 + // MIR for `identity` after SeparateConstSwitch
4 fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
5 debug x => _1; // in scope 0 at $DIR/separate_const_switch.rs:+0:13: +0:14
6 let mut _0: std::result::Result<i32, i32>; // return place in scope 0 at $DIR/separate_const_switch.rs:+0:37: +0:53
7 let mut _2: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
8 let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
9 let mut _4: std::result::Result<i32, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
10 let mut _5: isize; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
11 let _6: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
12 let mut _7: !; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
13 let mut _8: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
14 let _9: i32; // in scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
16 debug residual => _6; // in scope 1 at $DIR/separate_const_switch.rs:+1:9: +1:10
18 scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:25:8: 25:10
19 debug residual => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
20 let _16: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
21 let mut _17: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
22 let mut _18: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
24 debug e => _16; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
25 scope 10 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
26 debug t => _18; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
33 debug val => _9; // in scope 3 at $DIR/separate_const_switch.rs:+1:8: +1:10
37 scope 5 (inlined <Result<i32, i32> as Try>::branch) { // at $DIR/separate_const_switch.rs:25:8: 25:10
38 debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
39 let mut _10: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
40 let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
41 let mut _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
42 let _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
43 let mut _14: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
44 let mut _15: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
46 debug v => _11; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
49 debug e => _13; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
54 StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
55 StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
56 StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
57 _4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
58 _10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
59 - switchInt(move _10) -> [0_isize: bb7, 1_isize: bb5, otherwise: bb6]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
60 + switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
64 - StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
65 - _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
66 - switchInt(move _5) -> [0_isize: bb2, 1_isize: bb4, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
70 StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
71 _9 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
72 _2 = _9; // scope 4 at $DIR/separate_const_switch.rs:+1:8: +1:10
73 StorageDead(_9); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
74 Deinit(_0); // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11
75 ((_0 as Ok).0: i32) = move _2; // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11
76 discriminant(_0) = 0; // scope 0 at $DIR/separate_const_switch.rs:+1:5: +1:11
77 StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11
78 StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2
79 return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2
84 unreachable; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
89 StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
90 _6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
91 StorageLive(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
92 _8 = _6; // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
93 StorageLive(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
94 _16 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
95 StorageLive(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
96 StorageLive(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
97 _18 = move _16; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
98 _17 = move _18; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
99 StorageDead(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
100 Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
101 ((_0 as Err).0: i32) = move _17; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
102 discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
103 StorageDead(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
104 StorageDead(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
105 StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
106 StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
107 StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11
108 StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:+2:1: +2:2
109 return; // scope 0 at $DIR/separate_const_switch.rs:+2:2: +2:2
114 StorageLive(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
115 _13 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
116 StorageLive(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
117 StorageLive(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
118 _15 = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
119 Deinit(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
120 ((_14 as Err).0: i32) = move _15; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
121 discriminant(_14) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
122 StorageDead(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
123 Deinit(_3); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
124 ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>) = move _14; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
125 discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
126 StorageDead(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
127 StorageDead(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
128 - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
129 + StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
130 + _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
131 + switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
136 unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
141 StorageLive(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
142 _11 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
143 StorageLive(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
144 _12 = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
145 Deinit(_3); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
146 ((_3 as Continue).0: i32) = move _12; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
147 discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
148 StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
149 StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
150 - goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
151 + StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
152 + _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
153 + switchInt(move _5) -> [0_isize: bb1, 1_isize: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10