rust/tests/ui/codegen/equal-pointers-unequal/as-cast/print3.rs

24 lines
549 B
Rust

//@ known-bug: #107975
//@ compile-flags: -Copt-level=2
//@ run-pass
// https://github.com/rust-lang/rust/issues/107975#issuecomment-1430704499
fn main() {
let a = {
let v = 0;
&v as *const _ as usize
};
let b = {
let v = 0;
&v as *const _ as usize
};
assert_ne!(a, b);
assert_ne!(a, b);
let c = a;
assert_eq!(format!("{} {} {}", a == b, a == c, b == c), "false true false");
println!("{a} {b}");
assert_eq!(format!("{} {} {}", a == b, a == c, b == c), "true true true");
}