summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/dest-prop/simple.rs
blob: 3a4aec34e8cc43fd54158155834c2d7bab95150c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// ignore-wasm32 compiled with panic=abort by default
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
// unit-test: DestinationPropagation
// EMIT_MIR simple.nrvo.DestinationPropagation.diff
fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
    let mut buf = [0; 1024];
    init(&mut buf);
    buf
}

fn main() {
    let _ = nrvo(|buf| {
        buf[4] = 4;
    });
}