rust/tests/fail/dangling_pointers/deref-invalid-ptr.rs
2022-07-11 11:48:56 +00:00

8 lines
244 B
Rust

// This should fail even without validation.
//@compile-flags: -Zmiri-disable-validation -Zmiri-permissive-provenance
fn main() {
let x = 16usize as *const u32;
let _y = unsafe { &*x as *const u32 }; //~ ERROR: is a dangling pointer
}