rust/tests/mir-opt/nrvo_simple.rs
2023-04-06 10:08:07 +01:00

14 lines
305 B
Rust

// ignore-wasm32 compiled with panic=abort by default
// 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; });
}