Skip to content

Commit 8dfb278

Browse files
committed
Fix explicit cast test
1 parent 39d383d commit 8dfb278

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/run-pass-noseed/intptrcast.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// compile-flags: -Zmiri-seed=0000000000000000
2-
fn transmute_ptr_to_int<T>(x: *const T) -> usize {
3-
unsafe { std::mem::transmute::<*const T, usize>(x) * 1 }
2+
3+
// This returns a miri pointer at type usize, if the argument is a proper pointer
4+
fn transmute_ptr_to_int<T>(x: *const T) -> usize {
5+
unsafe { std::mem::transmute(x) }
46
}
57

68
fn main() {
79
// Some casting-to-int with arithmetic.
8-
let x = &42 as *const i32 as usize;
10+
let x = &42 as *const i32 as usize;
911
let y = x * 2;
1012
assert_eq!(y, x + x);
1113
let z = y as u8 as usize;

0 commit comments

Comments
 (0)