Skip to content

Commit 2e57394

Browse files
Add a failing test
1 parent a52085d commit 2e57394

3 files changed

+402
-0
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
// MIR for `method_1` after ElaborateDrops
2+
3+
fn method_1(_1: Guard) -> () {
4+
debug g => _1;
5+
let mut _0: ();
6+
let mut _2: std::result::Result<OtherDrop, ()>;
7+
let mut _3: &Guard;
8+
let _4: &Guard;
9+
let _5: Guard;
10+
let mut _6: &Guard;
11+
let mut _7: isize;
12+
let _8: OtherDrop;
13+
let _9: ();
14+
let mut _10: bool;
15+
let mut _11: bool;
16+
let mut _12: isize;
17+
let mut _13: isize;
18+
let mut _14: isize;
19+
scope 1 {
20+
debug other_drop => _8;
21+
}
22+
scope 2 {
23+
debug err => _9;
24+
}
25+
26+
bb0: {
27+
_11 = const false;
28+
_10 = const false;
29+
StorageLive(_2);
30+
StorageLive(_3);
31+
StorageLive(_4);
32+
StorageLive(_5);
33+
StorageLive(_6);
34+
_6 = &_1;
35+
_5 = <Guard as Clone>::clone(move _6) -> [return: bb1, unwind: bb16];
36+
}
37+
38+
bb1: {
39+
_11 = const true;
40+
StorageDead(_6);
41+
_4 = &_5;
42+
_3 = &(*_4);
43+
_2 = method_2(move _3) -> [return: bb2, unwind: bb14];
44+
}
45+
46+
bb2: {
47+
_10 = const true;
48+
StorageDead(_3);
49+
PlaceMention(_2);
50+
_7 = discriminant(_2);
51+
switchInt(move _7) -> [0: bb5, 1: bb4, otherwise: bb3];
52+
}
53+
54+
bb3: {
55+
unreachable;
56+
}
57+
58+
bb4: {
59+
StorageLive(_9);
60+
_9 = copy ((_2 as Err).0: ());
61+
_0 = const ();
62+
StorageDead(_9);
63+
goto -> bb7;
64+
}
65+
66+
bb5: {
67+
StorageLive(_8);
68+
_8 = move ((_2 as Ok).0: OtherDrop);
69+
_0 = const ();
70+
drop(_8) -> [return: bb6, unwind: bb11];
71+
}
72+
73+
bb6: {
74+
StorageDead(_8);
75+
goto -> bb7;
76+
}
77+
78+
bb7: {
79+
backward incompatible drop(_2);
80+
backward incompatible drop(_5);
81+
goto -> bb24;
82+
}
83+
84+
bb8: {
85+
drop(_5) -> [return: bb9, unwind: bb16];
86+
}
87+
88+
bb9: {
89+
_11 = const false;
90+
StorageDead(_5);
91+
StorageDead(_4);
92+
_10 = const false;
93+
StorageDead(_2);
94+
drop(_1) -> [return: bb10, unwind: bb17];
95+
}
96+
97+
bb10: {
98+
return;
99+
}
100+
101+
bb11 (cleanup): {
102+
goto -> bb28;
103+
}
104+
105+
bb12 (cleanup): {
106+
drop(_5) -> [return: bb13, unwind terminate(cleanup)];
107+
}
108+
109+
bb13 (cleanup): {
110+
goto -> bb15;
111+
}
112+
113+
bb14 (cleanup): {
114+
drop(_5) -> [return: bb15, unwind terminate(cleanup)];
115+
}
116+
117+
bb15 (cleanup): {
118+
goto -> bb30;
119+
}
120+
121+
bb16 (cleanup): {
122+
drop(_1) -> [return: bb17, unwind terminate(cleanup)];
123+
}
124+
125+
bb17 (cleanup): {
126+
resume;
127+
}
128+
129+
bb18: {
130+
goto -> bb8;
131+
}
132+
133+
bb19 (cleanup): {
134+
goto -> bb15;
135+
}
136+
137+
bb20 (cleanup): {
138+
goto -> bb15;
139+
}
140+
141+
bb21: {
142+
goto -> bb18;
143+
}
144+
145+
bb22: {
146+
goto -> bb18;
147+
}
148+
149+
bb23 (cleanup): {
150+
goto -> bb15;
151+
}
152+
153+
bb24: {
154+
_12 = discriminant(_2);
155+
switchInt(move _12) -> [0: bb21, otherwise: bb22];
156+
}
157+
158+
bb25 (cleanup): {
159+
_13 = discriminant(_2);
160+
switchInt(move _13) -> [0: bb19, otherwise: bb23];
161+
}
162+
163+
bb26 (cleanup): {
164+
goto -> bb12;
165+
}
166+
167+
bb27 (cleanup): {
168+
goto -> bb12;
169+
}
170+
171+
bb28 (cleanup): {
172+
_14 = discriminant(_2);
173+
switchInt(move _14) -> [0: bb26, otherwise: bb27];
174+
}
175+
176+
bb29 (cleanup): {
177+
drop(_5) -> [return: bb16, unwind terminate(cleanup)];
178+
}
179+
180+
bb30 (cleanup): {
181+
switchInt(copy _11) -> [0: bb16, otherwise: bb29];
182+
}
183+
}
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
// MIR for `method_1` after ElaborateDrops
2+
3+
fn method_1(_1: Guard) -> () {
4+
debug g => _1;
5+
let mut _0: ();
6+
let mut _2: std::result::Result<OtherDrop, ()>;
7+
let mut _3: &Guard;
8+
let _4: &Guard;
9+
let _5: Guard;
10+
let mut _6: &Guard;
11+
let mut _7: isize;
12+
let _8: OtherDrop;
13+
let _9: ();
14+
let mut _10: bool;
15+
let mut _11: bool;
16+
let mut _12: isize;
17+
let mut _13: isize;
18+
let mut _14: isize;
19+
scope 1 {
20+
debug other_drop => _8;
21+
}
22+
scope 2 {
23+
debug err => _9;
24+
}
25+
26+
bb0: {
27+
_11 = const false;
28+
_10 = const false;
29+
StorageLive(_2);
30+
StorageLive(_3);
31+
StorageLive(_4);
32+
StorageLive(_5);
33+
StorageLive(_6);
34+
_6 = &_1;
35+
_5 = <Guard as Clone>::clone(move _6) -> [return: bb1, unwind: bb16];
36+
}
37+
38+
bb1: {
39+
_11 = const true;
40+
StorageDead(_6);
41+
_4 = &_5;
42+
_3 = &(*_4);
43+
_2 = method_2(move _3) -> [return: bb2, unwind: bb14];
44+
}
45+
46+
bb2: {
47+
_10 = const true;
48+
StorageDead(_3);
49+
PlaceMention(_2);
50+
_7 = discriminant(_2);
51+
switchInt(move _7) -> [0: bb5, 1: bb4, otherwise: bb3];
52+
}
53+
54+
bb3: {
55+
unreachable;
56+
}
57+
58+
bb4: {
59+
StorageLive(_9);
60+
_9 = copy ((_2 as Err).0: ());
61+
_0 = const ();
62+
StorageDead(_9);
63+
goto -> bb7;
64+
}
65+
66+
bb5: {
67+
StorageLive(_8);
68+
_8 = move ((_2 as Ok).0: OtherDrop);
69+
_0 = const ();
70+
drop(_8) -> [return: bb6, unwind: bb11];
71+
}
72+
73+
bb6: {
74+
StorageDead(_8);
75+
goto -> bb7;
76+
}
77+
78+
bb7: {
79+
backward incompatible drop(_2);
80+
backward incompatible drop(_5);
81+
goto -> bb24;
82+
}
83+
84+
bb8: {
85+
drop(_5) -> [return: bb9, unwind: bb16];
86+
}
87+
88+
bb9: {
89+
_11 = const false;
90+
StorageDead(_5);
91+
StorageDead(_4);
92+
_10 = const false;
93+
StorageDead(_2);
94+
drop(_1) -> [return: bb10, unwind: bb17];
95+
}
96+
97+
bb10: {
98+
return;
99+
}
100+
101+
bb11 (cleanup): {
102+
goto -> bb28;
103+
}
104+
105+
bb12 (cleanup): {
106+
drop(_5) -> [return: bb13, unwind terminate(cleanup)];
107+
}
108+
109+
bb13 (cleanup): {
110+
goto -> bb15;
111+
}
112+
113+
bb14 (cleanup): {
114+
drop(_5) -> [return: bb15, unwind terminate(cleanup)];
115+
}
116+
117+
bb15 (cleanup): {
118+
goto -> bb30;
119+
}
120+
121+
bb16 (cleanup): {
122+
drop(_1) -> [return: bb17, unwind terminate(cleanup)];
123+
}
124+
125+
bb17 (cleanup): {
126+
resume;
127+
}
128+
129+
bb18: {
130+
goto -> bb8;
131+
}
132+
133+
bb19 (cleanup): {
134+
goto -> bb15;
135+
}
136+
137+
bb20 (cleanup): {
138+
goto -> bb15;
139+
}
140+
141+
bb21: {
142+
goto -> bb18;
143+
}
144+
145+
bb22: {
146+
goto -> bb18;
147+
}
148+
149+
bb23 (cleanup): {
150+
goto -> bb15;
151+
}
152+
153+
bb24: {
154+
_12 = discriminant(_2);
155+
switchInt(move _12) -> [0: bb21, otherwise: bb22];
156+
}
157+
158+
bb25 (cleanup): {
159+
_13 = discriminant(_2);
160+
switchInt(move _13) -> [0: bb19, otherwise: bb23];
161+
}
162+
163+
bb26 (cleanup): {
164+
goto -> bb12;
165+
}
166+
167+
bb27 (cleanup): {
168+
goto -> bb12;
169+
}
170+
171+
bb28 (cleanup): {
172+
_14 = discriminant(_2);
173+
switchInt(move _14) -> [0: bb26, otherwise: bb27];
174+
}
175+
176+
bb29 (cleanup): {
177+
drop(_5) -> [return: bb16, unwind terminate(cleanup)];
178+
}
179+
180+
bb30 (cleanup): {
181+
switchInt(copy _11) -> [0: bb16, otherwise: bb29];
182+
}
183+
}

0 commit comments

Comments
 (0)