mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #128500 - clubby789:122600-test, r=Mark-Simulacrum
Add test for updating enum discriminant through pointer Closes #122600
This commit is contained in:
commit
3c8b25905c
19
tests/codegen/issues/issue-122600-ptr-discriminant-update.rs
Normal file
19
tests/codegen/issues/issue-122600-ptr-discriminant-update.rs
Normal file
@ -0,0 +1,19 @@
|
||||
//@ compile-flags: -O
|
||||
//@ min-llvm-version: 19
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub enum State {
|
||||
A([u8; 753]),
|
||||
B([u8; 753]),
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @update
|
||||
#[no_mangle]
|
||||
pub unsafe fn update(s: *mut State) {
|
||||
// CHECK-NEXT: start:
|
||||
// CHECK-NEXT: store i8
|
||||
// CHECK-NEXT: ret
|
||||
let State::A(v) = s.read() else { std::hint::unreachable_unchecked() };
|
||||
s.write(State::B(v));
|
||||
}
|
Loading…
Reference in New Issue
Block a user