]> git.lizzy.rs Git - rust.git/blob - tests/compile-fail/dangling_zst_deref.rs
Auto merge of #896 - tmandry:add-generator-uninhabited-test, r=RalfJung
[rust.git] / tests / compile-fail / dangling_zst_deref.rs
1 fn main() {
2     let p = {
3         let b = Box::new(42);
4         &*b as *const i32 as *const ()
5     };
6     let _x = unsafe { *p }; //~ ERROR dangling pointer was dereferenced
7 }