We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5961977 commit a29f86bCopy full SHA for a29f86b
tests/compile-fail/dangling_pointers/dangling_pointer_addr_of.rs
@@ -0,0 +1,13 @@
1
+// Make sure we find these even with many checks disabled.
2
+// compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
3
+#![feature(raw_ref_macros)]
4
+use std::ptr;
5
+
6
+fn main() {
7
+ let p = {
8
+ let b = Box::new(42);
9
+ &*b as *const i32
10
+ };
11
+ let x = unsafe { ptr::raw_const!(*p) }; //~ ERROR dereferenced after this allocation got freed
12
+ panic!("this should never print: {:?}", x);
13
+}
0 commit comments