Skip to content

Commit 9317d32

Browse files
Add comment clarifying test
Co-authored-by: Ralf Jung <post@ralfj.de>
1 parent e057d48 commit 9317d32

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/compile-fail/ptr_int_guess.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ fn main() {
66

77
// TODO: switch this to addr() once we intrinsify it
88
let x_usize: usize = unsafe { std::mem::transmute(x_ptr) };
9+
// Cast back a pointer that did *not* get exposed.
910
let ptr = x_usize as *const i32;
1011
assert_eq!(unsafe { *ptr }, 3); //~ ERROR Undefined Behavior: dereferencing pointer failed
1112
}

0 commit comments

Comments
 (0)