From 531830cecd8467735e5c6fd9caa7a28683c028fb Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 19 Sep 2023 10:46:06 +0200 Subject: [PATCH] Update to LLVM 17.0.0 This rebases our LLVM fork to 17.0.0. Fixes #115681. --- .gitmodules | 2 +- src/llvm-project | 2 +- tests/ui/match/issue-115681.rs | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 tests/ui/match/issue-115681.rs diff --git a/.gitmodules b/.gitmodules index a13a2f5e01b51..f5025097a18dc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -33,7 +33,7 @@ [submodule "src/llvm-project"] path = src/llvm-project url = https://github.com/rust-lang/llvm-project.git - branch = rustc/17.0-2023-07-29 + branch = rustc/17.0-2023-09-19 shallow = true [submodule "src/doc/embedded-book"] path = src/doc/embedded-book diff --git a/src/llvm-project b/src/llvm-project index 0537f6354cffe..42263494d29fe 160000 --- a/src/llvm-project +++ b/src/llvm-project @@ -1 +1 @@ -Subproject commit 0537f6354cffe546cbf47f6dc9c7f82e49e86cfb +Subproject commit 42263494d29febc26d3c1ebdaa7b63677573ec47 diff --git a/tests/ui/match/issue-115681.rs b/tests/ui/match/issue-115681.rs new file mode 100644 index 0000000000000..c41e808e170c3 --- /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); +}