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 22c97b3 commit fcf3bc2Copy full SHA for fcf3bc2
tests/compile-fail/provenance/ptr_invalid.rs
@@ -0,0 +1,10 @@
1
+// compile-flags: -Zmiri-permissive-provenance
2
+#![feature(strict_provenance)]
3
+
4
+// Ensure that a `ptr::invalid` ptr is truly invalid.
5
+fn main() {
6
+ let x = 42;
7
+ let xptr = &x as *const i32;
8
+ let xptr_invalid = std::ptr::invalid::<i32>(xptr.expose_addr());
9
+ let _val = unsafe { *xptr_invalid }; //~ ERROR is not a valid pointer
10
+}
0 commit comments