]>
Commit | Line | Data |
---|---|---|
1b1a35ee | 1 | // compile-flags: -Zunsound-mir-opts |
3dfed10e XL |
2 | // EMIT_MIR_FOR_EACH_BIT_WIDTH |
3 | // EMIT_MIR matches_reduce_branches.foo.MatchBranchSimplification.diff | |
4 | // EMIT_MIR matches_reduce_branches.bar.MatchBranchSimplification.diff | |
5 | ||
6 | fn foo(bar: Option<()>) { | |
7 | if matches!(bar, None) { | |
8 | () | |
9 | } | |
10 | } | |
11 | ||
12 | fn bar(i: i32) -> (bool, bool, bool, bool) { | |
13 | let a; | |
14 | let b; | |
15 | let c; | |
16 | let d; | |
17 | ||
18 | match i { | |
19 | 7 => { | |
20 | a = false; | |
21 | b = true; | |
22 | c = false; | |
23 | d = true; | |
24 | () | |
25 | } | |
26 | _ => { | |
27 | a = true; | |
28 | b = false; | |
29 | c = false; | |
30 | d = true; | |
31 | () | |
32 | } | |
33 | }; | |
34 | ||
35 | (a, b, c, d) | |
36 | } | |
37 | ||
38 | ||
39 | fn main() { | |
40 | let _ = foo(None); | |
41 | let _ = foo(Some(())); | |
42 | let _ = bar(0); | |
43 | } |