summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/mutable_variable_no_prop.rs
blob: 49e9a701581b35bbb3e48e6fe7778fd2fe912dca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// unit-test: ConstProp

// Verify that we do not propagate the contents of this mutable static.
static mut STATIC: u32 = 0x42424242;

// EMIT_MIR mutable_variable_no_prop.main.ConstProp.diff
fn main() {
    // CHECK-LABEL: fn main(
    // CHECK: debug x => [[x:_.*]];
    // CHECK: debug y => [[y:_.*]];
    // CHECK: [[x]] = const 42_u32;
    // CHECK: [[tmp:_.*]] = (*{{_.*}});
    // CHECK: [[x]] = move [[tmp]];
    // CHECK: [[y]] = [[x]];
    let mut x = 42;
    unsafe {
        x = STATIC;
    }
    let y = x;
}