summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs
blob: 04e347fc03deb33c175542d4205360ef0049ba59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: ConstProp

// EMIT_MIR mutable_variable_unprop_assign.main.ConstProp.diff
fn main() {
    // CHECK-LABEL: fn main(
    // CHECK: debug a => [[a:_.*]];
    // CHECK: debug x => [[x:_.*]];
    // CHECK: debug y => [[y:_.*]];
    // CHECK: debug z => [[z:_.*]];
    // CHECK: [[a]] = foo()
    // CHECK: [[x]] = const (1_i32, 2_i32);
    // CHECK: [[tmp:_.*]] = [[a]];
    // CHECK: ([[x]].1: i32) = move [[tmp]];
    // CHECK: [[y]] = ([[x]].1: i32);
    // CHECK: [[z]] = const 1_i32;
    let a = foo();
    let mut x: (i32, i32) = (1, 2);
    x.1 = a;
    let y = x.1;
    let z = x.0;
}

#[inline(never)]
fn foo() -> i32 {
    unimplemented!()
}