]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/deref-invalid-ptr.rs
561017293a1655af8c930cd5186d1676eda2c7d7
[rust.git] / tests / compile-fail / deref-invalid-ptr.rs
1 // This should fail even without validation.
2 // compile-flags: -Zmiri-disable-validation
3
4 fn main() {
5     let x = 2usize as *const u32;
6     let _y = unsafe { &*x as *const u32 }; //~ ERROR invalid use of 2 as a pointer
7 }