summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/address_of_pair.rs
blob: 43dc9bae625347336da5b3724d1d0be813b5e877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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());
}