rust/tests/compile-fail/dangling_pointers/deref-invalid-ptr.rs
2020-04-11 11:36:55 +02:00

8 lines
223 B
Rust

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