rust/tests/mir-opt/const_prop/address_of_pair.rs
Camille GILLOT e2caebc4a6 Add tests.
2023-05-04 21:50:46 +00:00

18 lines
323 B
Rust

// unit-test: ConstProp
// EMIT_MIR address_of_pair.fn0.ConstProp.diff
pub fn fn0() -> bool {
let mut pair = (1, false);
let ptr = core::ptr::addr_of_mut!(pair.1);
pair = (1, false);
unsafe {
*ptr = true;
}
let ret = !pair.1;
return ret;
}
pub fn main() {
println!("{}", fn0());
}