rust/tests/mir-opt/const_prop/address_of_pair.rs
2023-10-19 15:51:52 +00:00

19 lines
341 B
Rust

// skip-filecheck
// 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());
}