add test for better ptr handling in enum niches
This commit is contained in:
parent
a1233a721d
commit
bf8b2aa8dc
9
tests/run-pass/enum_discriminant_ptr_value.rs
Normal file
9
tests/run-pass/enum_discriminant_ptr_value.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// A niche-optimized enum where the discriminant is a pointer value -- relies on ptr-to-int casts in
|
||||
// the niche handling code.
|
||||
// compile-flags: -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
let x = 42;
|
||||
let val: Option<&i32> = unsafe { std::mem::transmute((&x as *const i32).wrapping_offset(2)) };
|
||||
assert!(val.is_some());
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user