rust/tests/ui/match/issue-115681.rs
Nikita Popov 531830cecd Update to LLVM 17.0.0
This rebases our LLVM fork to 17.0.0.

Fixes #115681.
2023-09-19 11:14:35 +02:00

33 lines
588 B
Rust

// run-pass
// compile-flags: -C opt-level=1
// Make sure LLVM does not miscompile this match.
fn main() {
enum Bits {
None = 0x00,
Low = 0x40,
High = 0x80,
Both = 0xC0,
}
let value = Box::new(0x40u8);
let mut out = Box::new(0u8);
let bits = match *value {
0x00 => Bits::None,
0x40 => Bits::Low,
0x80 => Bits::High,
0xC0 => Bits::Both,
_ => return,
};
match bits {
Bits::None | Bits::Low => {
*out = 1;
}
_ => (),
}
assert_eq!(*out, 1);
}