]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/maybe_null_pointer_deref_zst.rs
d9f5ad4c696e161541b39c749cf7f3d56cf4af3a
[rust.git] / tests / compile-fail / maybe_null_pointer_deref_zst.rs
1 fn main() {
2     // This pointer *could* be NULL so we cannot load from it, not even at ZST
3     let ptr = (&0u8 as *const u8).wrapping_sub(0x800) as *const ();
4     let _x: () = unsafe { *ptr }; //~ ERROR outside bounds
5 }