diff options
| author | Nikita Popov <npopov@redhat.com> | 2023-09-19 10:46:06 +0200 |
|---|---|---|
| committer | Nikita Popov <npopov@redhat.com> | 2023-09-19 11:14:35 +0200 |
| commit | 531830cecd8467735e5c6fd9caa7a28683c028fb (patch) | |
| tree | 03d4e807d6b6cd58ae9acce8ea56905bc88a4458 /tests | |
| parent | de68911f4adaed19ac662880cf1a5ded9e44d685 (diff) | |
| download | rust-531830cecd8467735e5c6fd9caa7a28683c028fb.tar.gz rust-531830cecd8467735e5c6fd9caa7a28683c028fb.zip | |
Update to LLVM 17.0.0
This rebases our LLVM fork to 17.0.0. Fixes #115681.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/match/issue-115681.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/ui/match/issue-115681.rs b/tests/ui/match/issue-115681.rs new file mode 100644 index 00000000000..c41e808e170 --- /dev/null +++ b/tests/ui/match/issue-115681.rs @@ -0,0 +1,32 @@ +// 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); +} |
