rust/tests/run-pass/intptrcast.rs

10 lines
206 B
Rust
Raw Normal View History

2019-06-22 09:25:16 -05:00
// compile-flags: -Zmiri-seed=0000000000000000
fn main() {
let x = &42 as *const i32 as usize;
let y = x * 2;
2019-06-24 21:47:37 -05:00
assert_eq!(y, x + x);
2019-06-22 09:25:16 -05:00
let z = y as u8 as usize;
assert_eq!(z, y % 256);
}