rust/tests/mir-opt/nrvo_simple.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
305 B
Rust
Raw Normal View History

2023-04-05 09:44:20 +01:00
// ignore-wasm32 compiled with panic=abort by default
// unit-test: RenameReturnPlace
2020-07-27 21:22:43 +02:00
// EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff
2020-05-15 14:57:42 -07:00
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; });
}