rust/tests/mir-opt/nrvo_simple.rs

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

17 lines
322 B
Rust
Raw Normal View History

// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//@ test-mir-pass: RenameReturnPlace
// EMIT_MIR nrvo_simple.nrvo.RenameReturnPlace.diff
2020-05-15 21:57:42 +00: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;
});
2020-05-15 21:57:42 +00:00
}