We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 39d383d commit 8dfb278Copy full SHA for 8dfb278
tests/run-pass-noseed/intptrcast.rs
@@ -1,11 +1,13 @@
1
// 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 }
+
+// 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) }
6
}
7
8
fn main() {
9
// Some casting-to-int with arithmetic.
- let x = &42 as *const i32 as usize;
10
+ let x = &42 as *const i32 as usize;
11
let y = x * 2;
12
assert_eq!(y, x + x);
13
let z = y as u8 as usize;
0 commit comments