Skip to content

Commit c0a811a

Browse files
committed
Add regression test for matching on u8
1 parent 5e3f1b1 commit c0a811a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/test/mir-opt/matches_u8.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// EMIT_MIR_FOR_EACH_BIT_WIDTH
2+
// EMIT_MIR matches_u8.exhaustive_match.MatchBranchSimplification.diff
3+
4+
pub enum E {
5+
A,
6+
B,
7+
}
8+
9+
// This only breaks on u8's, but probably still have to test i8.
10+
#[no_mangle]
11+
pub fn exhaustive_match(e: E) -> u8 {
12+
match e {
13+
E::A => 0,
14+
E::B => 1,
15+
}
16+
}
17+
18+
fn main() {
19+
assert_eq!(exhaustive_match(E::A), 0);
20+
assert_eq!(exhaustive_match(E::B), 1);
21+
}

0 commit comments

Comments
 (0)