rust/tests/compile-fail/deref-invalid-ptr.rs
2020-03-19 08:25:08 +01:00

8 lines
221 B
Rust

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