@@ -28,10 +28,7 @@ const CASES: &[(bool, bool, bool, i32)] = &[
2828
2929fn main ( ) {
3030 for & ( cond, items_1, items_2, result) in CASES {
31- assert_eq ! (
32- complicated_match( cond, ( items_1, items_2, String :: new( ) ) ) ,
33- result,
34- ) ;
31+ assert_eq ! ( complicated_match( cond, ( items_1, items_2, String :: new( ) ) ) , result, ) ;
3532 }
3633}
3734
@@ -64,31 +61,38 @@ fn main() {
6461// }
6562// bb0: {
6663// FakeRead(ForMatchedPlace, _2);
67- // switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb5 ];
64+ // switchInt((_2.0: bool)) -> [false: bb2, otherwise: bb3 ];
6865// }
6966// bb1 (cleanup): {
7067// resume;
7168// }
72- // bb2: {
73- // falseEdges -> [real: bb8 , imaginary: bb3 ];
69+ // bb2: { // pre-binding for arm 1 first pattern
70+ // falseEdges -> [real: bb9 , imaginary: bb4 ];
7471// }
7572// bb3: {
76- // falseEdges -> [real: bb17, imaginary: bb4 ];
73+ // switchInt((_2.1: bool)) -> [false: bb4, otherwise: bb5 ];
7774// }
78- // bb4: {
79- // falseEdges -> [real: bb25 , imaginary: bb26 ];
75+ // bb4: { // pre-binding for arm 1 second pattern
76+ // falseEdges -> [real: bb18 , imaginary: bb6 ];
8077// }
8178// bb5: {
82- // switchInt((_2.1 : bool)) -> [false: bb3 , otherwise: bb6];
79+ // switchInt((_2.0 : bool)) -> [false: bb7 , otherwise: bb6];
8380// }
84- // bb6: {
85- // switchInt((_2.0: bool)) -> [false : bb26, otherwise: bb4 ];
81+ // bb6: { // pre-binding for arm 2 first pattern
82+ // falseEdges -> [real : bb26, imaginary: bb7 ];
8683// }
87- // bb7: { // arm 1
84+ // bb7: { // bindings for arm 2 - second pattern
85+ // StorageLive(_15);
86+ // _15 = (_2.1: bool);
87+ // StorageLive(_16);
88+ // _16 = move (_2.2: std::string::String);
89+ // goto -> bb25;
90+ // }
91+ // bb8: { // arm 1
8892// _0 = const 1i32;
89- // drop(_7) -> [return: bb23 , unwind: bb13 ];
93+ // drop(_7) -> [return: bb24 , unwind: bb14 ];
9094// }
91- // bb8 : { // guard - first time
95+ // bb9 : { // guard - first time
9296// StorageLive(_6);
9397// _6 = &(_2.1: bool);
9498// StorageLive(_8);
@@ -99,34 +103,34 @@ fn main() {
99103// StorageLive(_10);
100104// _10 = _1;
101105// FakeRead(ForMatchedPlace, _10);
102- // switchInt(_10) -> [false: bb10 , otherwise: bb9 ];
106+ // switchInt(_10) -> [false: bb11 , otherwise: bb10 ];
103107// }
104- // bb9 : {
105- // falseEdges -> [real: bb11 , imaginary: bb10 ];
108+ // bb10 : {
109+ // falseEdges -> [real: bb12 , imaginary: bb11 ];
106110// }
107- // bb10 : { // `else` block - first time
111+ // bb11 : { // `else` block - first time
108112// _9 = (*_6);
109113// StorageDead(_10);
110- // switchInt(move _9) -> [false: bb16 , otherwise: bb15 ];
114+ // switchInt(move _9) -> [false: bb17 , otherwise: bb16 ];
111115// }
112- // bb11 : { // `return 3` - first time
116+ // bb12 : { // `return 3` - first time
113117// _0 = const 3i32;
114118// StorageDead(_10);
115119// StorageDead(_9);
116120// StorageDead(_8);
117121// StorageDead(_6);
118- // goto -> bb14 ;
122+ // goto -> bb15 ;
119123// }
120- // bb12 : {
124+ // bb13 : {
121125// return;
122126// }
123- // bb13 (cleanup): {
127+ // bb14 (cleanup): {
124128// drop(_2) -> bb1;
125129// }
126- // bb14: {
127- // drop(_2) -> [return: bb12, unwind: bb1];
128- // }
129130// bb15: {
131+ // drop(_2) -> [return: bb13, unwind: bb1];
132+ // }
133+ // bb16: {
130134// StorageDead(_9);
131135// FakeRead(ForMatchGuard, _3);
132136// FakeRead(ForMatchGuard, _4);
@@ -136,15 +140,15 @@ fn main() {
136140// _5 = (_2.1: bool);
137141// StorageLive(_7);
138142// _7 = move (_2.2: std::string::String);
139- // goto -> bb7 ;
143+ // goto -> bb8 ;
140144// }
141- // bb16 : { // guard otherwise case - first time
145+ // bb17 : { // guard otherwise case - first time
142146// StorageDead(_9);
143147// StorageDead(_8);
144148// StorageDead(_6);
145- // falseEdges -> [real: bb5 , imaginary: bb3 ];
149+ // falseEdges -> [real: bb3 , imaginary: bb4 ];
146150// }
147- // bb17 : { // guard - second time
151+ // bb18 : { // guard - second time
148152// StorageLive(_6);
149153// _6 = &(_2.0: bool);
150154// StorageLive(_8);
@@ -155,25 +159,25 @@ fn main() {
155159// StorageLive(_13);
156160// _13 = _1;
157161// FakeRead(ForMatchedPlace, _13);
158- // switchInt(_13) -> [false: bb19 , otherwise: bb18 ];
162+ // switchInt(_13) -> [false: bb20 , otherwise: bb19 ];
159163// }
160- // bb18 : {
161- // falseEdges -> [real: bb20 , imaginary: bb19 ];
164+ // bb19 : {
165+ // falseEdges -> [real: bb21 , imaginary: bb20 ];
162166// }
163- // bb19 : { // `else` block - second time
167+ // bb20 : { // `else` block - second time
164168// _12 = (*_6);
165169// StorageDead(_13);
166- // switchInt(move _12) -> [false: bb22 , otherwise: bb21 ];
170+ // switchInt(move _12) -> [false: bb23 , otherwise: bb22 ];
167171// }
168- // bb20 : {
172+ // bb21 : {
169173// _0 = const 3i32;
170174// StorageDead(_13);
171175// StorageDead(_12);
172176// StorageDead(_8);
173177// StorageDead(_6);
174- // goto -> bb14 ;
178+ // goto -> bb15 ;
175179// }
176- // bb21 : { // bindings for arm 1
180+ // bb22 : { // bindings for arm 1
177181// StorageDead(_12);
178182// FakeRead(ForMatchGuard, _3);
179183// FakeRead(ForMatchGuard, _4);
@@ -183,46 +187,40 @@ fn main() {
183187// _5 = (_2.0: bool);
184188// StorageLive(_7);
185189// _7 = move (_2.2: std::string::String);
186- // goto -> bb7 ;
190+ // goto -> bb8 ;
187191// }
188- // bb22 : { // Guard otherwise case - second time
192+ // bb23 : { // Guard otherwise case - second time
189193// StorageDead(_12);
190194// StorageDead(_8);
191195// StorageDead(_6);
192- // falseEdges -> [real: bb6 , imaginary: bb4 ];
196+ // falseEdges -> [real: bb5 , imaginary: bb6 ];
193197// }
194- // bb23 : { // rest of arm 1
198+ // bb24 : { // rest of arm 1
195199// StorageDead(_7);
196200// StorageDead(_5);
197201// StorageDead(_8);
198202// StorageDead(_6);
199203// goto -> bb28;
200204// }
201- // bb24 : { // arm 2
205+ // bb25 : { // arm 2
202206// _0 = const 2i32;
203- // drop(_16) -> [return: bb27, unwind: bb13 ];
207+ // drop(_16) -> [return: bb27, unwind: bb14 ];
204208// }
205- // bb25 : { // bindings for arm 2 - first pattern
209+ // bb26 : { // bindings for arm 2 - first pattern
206210// StorageLive(_15);
207211// _15 = (_2.1: bool);
208212// StorageLive(_16);
209213// _16 = move (_2.2: std::string::String);
210- // goto -> bb24;
211- // }
212- // bb26: { // bindings for arm 2 - second pattern
213- // StorageLive(_15);
214- // _15 = (_2.1: bool);
215- // StorageLive(_16);
216- // _16 = move (_2.2: std::string::String);
217- // goto -> bb24;
214+ // goto -> bb25;
218215// }
216+
219217// bb27: { // rest of arm 2
220218// StorageDead(_16);
221219// StorageDead(_15);
222220// goto -> bb28;
223221// }
224222// bb28: {
225- // drop(_2) -> [return: bb12 , unwind: bb1];
223+ // drop(_2) -> [return: bb13 , unwind: bb1];
226224// }
227225// END rustc.complicated_match.SimplifyCfg-initial.after.mir
228226// START rustc.complicated_match.ElaborateDrops.after.mir
0 commit comments