Skip to content

Commit 76640ff

Browse files
committed
addr no longer exposes :)
1 parent 2d24b1b commit 76640ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// compile-flags: -Zmiri-permissive-provenance -Zmiri-disable-stacked-borrows -Zmiri-allow-ptr-int-transmute
1+
// compile-flags: -Zmiri-permissive-provenance -Zmiri-disable-stacked-borrows
2+
#![feature(strict_provenance)]
23

34
fn main() {
45
let x: i32 = 3;
56
let x_ptr = &x as *const i32;
67

7-
// TODO: switch this to addr() once we intrinsify it
8-
let x_usize: usize = unsafe { std::mem::transmute(x_ptr) };
8+
let x_usize: usize = x_ptr.addr();
99
// Cast back a pointer that did *not* get exposed.
10-
let ptr = x_usize as *const i32;
10+
let ptr = std::ptr::from_exposed_addr::<i32>(x_usize);
1111
assert_eq!(unsafe { *ptr }, 3); //~ ERROR Undefined Behavior: dereferencing pointer failed
1212
}

0 commit comments

Comments
 (0)