Add regression test for matching on u8
This commit is contained in:
parent
5e3f1b148d
commit
c0a811a24e
1 changed files with 21 additions and 0 deletions
21
src/test/mir-opt/matches_u8.rs
Normal file
21
src/test/mir-opt/matches_u8.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR matches_u8.exhaustive_match.MatchBranchSimplification.diff
|
||||
|
||||
pub enum E {
|
||||
A,
|
||||
B,
|
||||
}
|
||||
|
||||
// This only breaks on u8's, but probably still have to test i8.
|
||||
#[no_mangle]
|
||||
pub fn exhaustive_match(e: E) -> u8 {
|
||||
match e {
|
||||
E::A => 0,
|
||||
E::B => 1,
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(exhaustive_match(E::A), 0);
|
||||
assert_eq!(exhaustive_match(E::B), 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue