about summary refs log tree commit diff
path: root/tests/mir-opt/dest-prop/cycle.rs
blob: 86b9b713fd001633eef9d009c4d77ec912920e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that cyclic assignments don't hang DestinationPropagation, and result in reasonable code.
//@ test-mir-pass: DestinationPropagation
fn val() -> i32 {
    1
}

// EMIT_MIR cycle.main.DestinationPropagation.diff
fn main() {
    // CHECK-LABEL: main(
    // CHECK: debug x => [[x:_.*]];
    // CHECK: [[x]] = val()
    // CHECK-NOT: [[x]] = {{_.*}};
    let mut x = val();
    let y = x;
    let z = y;
    x = z;

    drop(x);
}