Skip to content

Commit 89ea69a

Browse files
committed
Add a test for simple matches
1 parent df3de7b commit 89ea69a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/test/mir-opt/simple-match.rs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Test that we don't generate unnecessarily large MIR for very simple matches
2+
3+
fn match_bool(x: bool) -> usize {
4+
match x {
5+
true => 10,
6+
_ => 20,
7+
}
8+
}
9+
10+
fn main() {}
11+
12+
13+
// END RUST SOURCE
14+
// START rustc.match_bool.mir_map.0.mir
15+
// bb0: {
16+
// FakeRead(ForMatchedPlace, _1);
17+
// switchInt(_1) -> [false: bb3, otherwise: bb2];
18+
// }
19+
// bb1 (cleanup): {
20+
// resume;
21+
// }
22+
// bb2: {
23+
// falseEdges -> [real: bb4, imaginary: bb3];
24+
// }
25+
// bb3: {
26+
// _0 = const 20usize;
27+
// goto -> bb5;
28+
// }
29+
// bb4: {
30+
// _0 = const 10usize;
31+
// goto -> bb5;
32+
// }
33+
// bb5: {
34+
// goto -> bb6;
35+
// }
36+
// bb6: {
37+
// return;
38+
// }
39+
// END rustc.match_bool.mir_map.0.mir

0 commit comments

Comments
 (0)