]>
Commit | Line | Data |
---|---|---|
ff7c6d11 | 1 | // compile-flags: -Z borrowck=mir |
abe05a73 XL |
2 | |
3 | fn guard() -> bool { | |
4 | false | |
5 | } | |
6 | ||
74b04a01 | 7 | fn guard2(_: i32) -> bool { |
abe05a73 XL |
8 | true |
9 | } | |
10 | ||
11 | // no_mangle to make sure this gets instantiated even in an executable. | |
12 | #[no_mangle] | |
3dfed10e | 13 | // EMIT_MIR match_false_edges.full_tested_match.PromoteTemps.after.mir |
abe05a73 XL |
14 | pub fn full_tested_match() { |
15 | let _ = match Some(42) { | |
16 | Some(x) if guard() => (1, x), | |
17 | Some(y) => (2, y), | |
18 | None => (3, 3), | |
19 | }; | |
20 | } | |
21 | ||
22 | // no_mangle to make sure this gets instantiated even in an executable. | |
23 | #[no_mangle] | |
3dfed10e | 24 | // EMIT_MIR match_false_edges.full_tested_match2.PromoteTemps.before.mir |
abe05a73 XL |
25 | pub fn full_tested_match2() { |
26 | let _ = match Some(42) { | |
27 | Some(x) if guard() => (1, x), | |
28 | None => (3, 3), | |
29 | Some(y) => (2, y), | |
30 | }; | |
31 | } | |
32 | ||
3dfed10e | 33 | // EMIT_MIR match_false_edges.main.PromoteTemps.before.mir |
abe05a73 XL |
34 | fn main() { |
35 | let _ = match Some(1) { | |
36 | Some(_w) if guard() => 1, | |
37 | _x => 2, | |
38 | Some(y) if guard2(y) => 3, | |
39 | _z => 4, | |
40 | }; | |
41 | } |