rust/tests/mir-opt/dest-prop/cycle.rs
Jubilee 4c493db0d9
Rollup merge of #122300 - CastilloDel:master, r=cjgillot
Add FileCheck annotations to mir-opt/dest-prop tests

Part of https://github.com/rust-lang/rust/issues/116971, adds FileCheck annotations to MIR-opt tests in tests/mir-opt/dest-prop.

I would like some feedback. Also, I don't know how to approach `union.rs`.  I couldn't figure out what it is testing.

r? cjgillot
2024-07-13 20:19:45 -07:00

21 lines
473 B
Rust

// 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);
}