Skip to content

Commit afe4262

Browse files
committed
test pointer string formatting
1 parent 3bf0655 commit afe4262

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/run-pass/intptrcast.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
// compile-flags: -Zmiri-seed=0000000000000000
22

33
fn main() {
4+
// Some casting-to-int with arithmetic.
45
let x = &42 as *const i32 as usize;
56
let y = x * 2;
67
assert_eq!(y, x + x);
78
let z = y as u8 as usize;
89
assert_eq!(z, y % 256);
10+
11+
// Pointer string formatting! We can't check the output as it changes when libstd changes,
12+
// but we can make sure Miri does not error.
13+
format!("{:?}", &mut 13 as *mut _);
914
}

0 commit comments

Comments
 (0)