4c493db0d9
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
23 lines
651 B
Rust
23 lines
651 B
Rust
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
|
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
|
|
//@ test-mir-pass: DestinationPropagation
|
|
// EMIT_MIR simple.nrvo.DestinationPropagation.diff
|
|
fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
|
|
// CHECK-LABEL: fn nrvo(
|
|
// CHECK: debug init => [[init:_.*]];
|
|
// CHECK: debug buf => [[buf:_.*]];
|
|
// CHECK: [[buf]] = [const 0_u8; 1024];
|
|
// CHECK-NOT: {{_.*}} = [[init]];
|
|
// CHECK: move [[init]](move {{_.*}})
|
|
// CHECK: {{_.*}} = [[buf]]
|
|
let mut buf = [0; 1024];
|
|
init(&mut buf);
|
|
buf
|
|
}
|
|
|
|
fn main() {
|
|
let _ = nrvo(|buf| {
|
|
buf[4] = 4;
|
|
});
|
|
}
|