raw_eq: using it on bytes with provenance is not UB (outside const-eval)
This commit is contained in:
parent
99322d84c4
commit
f97aba2271
7 changed files with 9 additions and 35 deletions
|
|
@ -1,10 +0,0 @@
|
|||
#![feature(intrinsics)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn raw_eq<T>(a: &T, b: &T) -> bool;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x = &0;
|
||||
unsafe { raw_eq(&x, &x) }; //~ERROR: `raw_eq` on bytes with provenance
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
error: Undefined Behavior: `raw_eq` on bytes with provenance
|
||||
--> $DIR/raw_eq_on_ptr.rs:LL:CC
|
||||
|
|
||||
LL | unsafe { raw_eq(&x, &x) };
|
||||
| ^^^^^^^^^^^^^^ `raw_eq` on bytes with provenance
|
||||
|
|
||||
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
|
||||
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
|
||||
= 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 1 previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue