2021-07-17 06:59:58 -05:00
|
|
|
// A niche-optimized enum where the discriminant is a pointer value -- relies on ptr-to-int casts in
|
|
|
|
// the niche handling code.
|
2022-07-08 11:08:32 -05:00
|
|
|
//@compile-flags: -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
|
2021-07-17 06:59:58 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = 42;
|
|
|
|
let val: Option<&i32> = unsafe { std::mem::transmute((&x as *const i32).wrapping_offset(2)) };
|
|
|
|
assert!(val.is_some());
|
|
|
|
}
|