1 // compile-flags: -Z borrowck=mir
7 fn guard2(_:i32) -> bool {
11 // no_mangle to make sure this gets instantiated even in an executable.
13 pub fn full_tested_match() {
14 let _ = match Some(42) {
15 Some(x) if guard() => (1, x),
21 // no_mangle to make sure this gets instantiated even in an executable.
23 pub fn full_tested_match2() {
24 let _ = match Some(42) {
25 Some(x) if guard() => (1, x),
32 let _ = match Some(1) {
33 Some(_w) if guard() => 1,
35 Some(y) if guard2(y) => 3,
42 // START rustc.full_tested_match.PromoteTemps.after.mir
45 // _2 = std::option::Option::<i32>::Some(const 42i32,);
46 // FakeRead(ForMatchedPlace, _2);
47 // _3 = discriminant(_2);
48 // switchInt(move _3) -> [0isize: bb4, 1isize: bb2, otherwise: bb5];
54 // falseEdges -> [real: bb6, imaginary: bb3]; //pre_binding1
57 // falseEdges -> [real: bb10, imaginary: bb4]; //pre_binding2
59 // bb4: { //pre_binding3 and arm3
60 // _1 = (const 3i32, const 3i32);
66 // bb6: { // binding1 and guard
68 // _11 = const full_tested_match::promoted[0];
69 // _6 = &(((*_11) as Some).0: i32);
72 // _7 = const guard() -> [return: bb7, unwind: bb1];
74 // bb7: { // end of guard
75 // switchInt(move _7) -> [false: bb9, otherwise: bb8];
79 // FakeRead(ForMatchGuard, _4);
80 // FakeRead(ForGuardBinding, _6);
82 // _5 = ((_2 as Some).0: i32);
85 // _1 = (const 1i32, move _8);
91 // bb9: { // to pre_binding2
98 // _9 = ((_2 as Some).0: i32);
101 // _1 = (const 2i32, move _10);
112 // END rustc.full_tested_match.PromoteTemps.after.mir
114 // START rustc.full_tested_match2.PromoteTemps.before.mir
117 // _2 = std::option::Option::<i32>::Some(const 42i32,);
118 // FakeRead(ForMatchedPlace, _2);
119 // _3 = discriminant(_2);
120 // switchInt(move _3) -> [0isize: bb3, 1isize: bb2, otherwise: bb4];
126 // falseEdges -> [real: bb5, imaginary: bb3];
129 // falseEdges -> [real: bb9, imaginary: bb10];
131 // bb4: { // to arm3 (can skip 2 since this is `Some`)
134 // bb5: { // binding1 and guard
136 // _6 = &((_2 as Some).0: i32);
139 // _7 = const guard() -> [return: bb6, unwind: bb1];
141 // bb6: { // end of guard
142 // switchInt(move _7) -> [false: bb8, otherwise: bb7];
146 // FakeRead(ForMatchGuard, _4);
147 // FakeRead(ForGuardBinding, _6);
149 // _5 = ((_2 as Some).0: i32);
152 // _1 = (const 1i32, move _8);
158 // bb8: { // to pre_binding3 (can skip 2 since this is `Some`)
161 // falseEdges -> [real: bb10, imaginary: bb3];
164 // _1 = (const 3i32, const 3i32);
167 // bb10: { // binding3 and arm3
169 // _9 = ((_2 as Some).0: i32);
172 // _1 = (const 2i32, move _10);
183 // END rustc.full_tested_match2.PromoteTemps.before.mir
185 // START rustc.main.PromoteTemps.before.mir
188 // _2 = std::option::Option::<i32>::Some(const 1i32,);
189 // FakeRead(ForMatchedPlace, _2);
190 // _4 = discriminant(_2);
191 // switchInt(move _4) -> [1isize: bb2, otherwise: bb3];
197 // falseEdges -> [real: bb5, imaginary: bb3];
200 // falseEdges -> [real: bb9, imaginary: bb4];
203 // falseEdges -> [real: bb10, imaginary: bb14];
207 // _7 = &((_2 as Some).0: i32);
210 // _8 = const guard() -> [return: bb6, unwind: bb1];
212 // bb6: { //end of guard1
213 // switchInt(move _8) -> [false: bb8, otherwise: bb7];
217 // FakeRead(ForMatchGuard, _5);
218 // FakeRead(ForGuardBinding, _7);
220 // _6 = ((_2 as Some).0: i32);
229 // falseEdges -> [real: bb3, imaginary: bb3];
231 // bb9: { // binding2 & arm2
238 // bb10: { // binding3: Some(y) if guard2(y)
240 // _11 = &((_2 as Some).0: i32);
245 // _12 = const guard2(move _13) -> [return: bb11, unwind: bb1];
247 // bb11: { // end of guard2
249 // switchInt(move _12) -> [false: bb13, otherwise: bb12];
251 // bb12: { // binding4 & arm4
253 // FakeRead(ForMatchGuard, _5);
254 // FakeRead(ForGuardBinding, _11);
256 // _10 = ((_2 as Some).0: i32);
265 // falseEdges -> [real: bb14, imaginary: bb14];
280 // END rustc.main.PromoteTemps.before.mir