From 8dfb278ac5ad47f7fac3d161ebb30d9efb9246a3 Mon Sep 17 00:00:00 2001 From: Christian Poveda Date: Wed, 3 Jul 2019 13:42:01 -0500 Subject: [PATCH] Fix explicit cast test --- tests/run-pass-noseed/intptrcast.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/run-pass-noseed/intptrcast.rs b/tests/run-pass-noseed/intptrcast.rs index 919083f98d3d..1b5251c91119 100644 --- a/tests/run-pass-noseed/intptrcast.rs +++ b/tests/run-pass-noseed/intptrcast.rs @@ -1,11 +1,13 @@ // compile-flags: -Zmiri-seed=0000000000000000 -fn transmute_ptr_to_int(x: *const T) -> usize { - unsafe { std::mem::transmute::<*const T, usize>(x) * 1 } + +// This returns a miri pointer at type usize, if the argument is a proper pointer +fn transmute_ptr_to_int(x: *const T) -> usize { + unsafe { std::mem::transmute(x) } } fn main() { // Some casting-to-int with arithmetic. - let x = &42 as *const i32 as usize; + let x = &42 as *const i32 as usize; let y = x * 2; assert_eq!(y, x + x); let z = y as u8 as usize;