-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 #2482 - RalfJung:raw-eq, r=RalfJung
add test for raw_eq on a pointer Let's make sure this keeps erroring; I have plans to refactor that part of the interpreter which will fix the error message (but could also lead to us accidentally accepting this which this test is there to avoid).
- Loading branch information
Showing
2 changed files
with
25 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![feature(intrinsics)] | ||
|
||
extern "rust-intrinsic" { | ||
fn raw_eq<T>(a: &T, b: &T) -> bool; | ||
} | ||
|
||
fn main() { | ||
let x = &0; | ||
// FIXME: the error message is not great (should be UB rather than 'unsupported') | ||
unsafe { raw_eq(&x, &x) }; //~ERROR: unsupported operation | ||
} |
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,14 @@ | ||
error: unsupported operation: unable to turn pointer into raw bytes | ||
--> $DIR/raw_eq_on_ptr.rs:LL:CC | ||
| | ||
LL | unsafe { raw_eq(&x, &x) }; | ||
| ^^^^^^^^^^^^^^ unable to turn pointer into raw bytes | ||
| | ||
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support | ||
= note: backtrace: | ||
= note: inside `main` at $DIR/raw_eq_on_ptr.rs:LL:CC | ||
|
||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace | ||
|
||
error: aborting due to previous error | ||
|