-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #1853 - RalfJung:negative-offsets, r=RalfJung
better errors for negative out-of-bounds offsets This is the Miri side of rust-lang/rust#87224
- Loading branch information
Showing
3 changed files
with
13 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
a72c360a30f9a8160e4f40340cecc9b1ce979cd7 | ||
718d53b0cb7dde93499cb92950d60b412f5a3d05 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// error-pattern: pointer to 1 byte starting at offset -1 is out-of-bounds | ||
fn main() { | ||
let v = [0i8; 4]; | ||
let x = &v as *const i8; | ||
let x = unsafe { x.offset(-1) }; | ||
panic!("this should never print: {:?}", x); | ||
} |