rust/tests/mir-opt/const_prop/address_of_pair.rs

18 lines
323 B
Rust
Raw Normal View History

2023-04-28 11:51:40 -05:00
// 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());
}