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