Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 74e87b1

Browse files
committed
add test for raw_eq on a pointer
1 parent 403b3f9 commit 74e87b1

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![feature(intrinsics)]
2+
3+
extern "rust-intrinsic" {
4+
fn raw_eq<T>(a: &T, b: &T) -> bool;
5+
}
6+
7+
fn main() {
8+
let x = &0;
9+
// FIXME: the error message is not great (should be UB rather than 'unsupported')
10+
unsafe { raw_eq(&x, &x) }; //~ERROR: unsupported operation
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: unsupported operation: unable to turn pointer into raw bytes
2+
--> $DIR/raw_eq_on_ptr.rs:LL:CC
3+
|
4+
LL | unsafe { raw_eq(&x, &x) };
5+
| ^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
6+
|
7+
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
8+
= note: backtrace:
9+
= note: inside `main` at $DIR/raw_eq_on_ptr.rs:LL:CC
10+
11+
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
12+
13+
error: aborting due to previous error
14+

0 commit comments

Comments
 (0)