summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/nrvo_simple.rs
blob: 5b403c560a7e16691e4d1e8d766e8a849b275f6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// unit-test: RenameReturnPlace

// EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.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; });
}