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 46ed39e commit cf26458Copy full SHA for cf26458
tests/compile-fail/intrinsics/out_of_bounds_ptr_3.rs
@@ -0,0 +1,7 @@
1
+// error-pattern: pointer to 1 byte starting at offset -1 is out-of-bounds
2
+fn main() {
3
+ let v = [0i8; 4];
4
+ let x = &v as *const i8;
5
+ let x = unsafe { x.offset(-1) };
6
+ panic!("this should never print: {:?}", x);
7
+}
0 commit comments