2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2023-06-08 02:18:34 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2020-05-24 14:37:09 -05:00
|
|
|
//! Copy of `nrvo-simple.rs`, to ensure that full dest-prop handles it too.
|
2022-04-24 16:34:24 -05:00
|
|
|
//@ unit-test: DestinationPropagation
|
2020-09-12 08:10:51 -05:00
|
|
|
// EMIT_MIR simple.nrvo.DestinationPropagation.diff
|
2020-05-24 14:37:09 -05: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;
|
|
|
|
});
|
|
|
|
}
|