Skip to content

Commit 2973063

Browse files
committed
test dangling ZST deref
1 parent f0e8717 commit 2973063

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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+
}

0 commit comments

Comments
 (0)