3 // When the NRVO is applied, the return place (`_0`) gets treated like a normal local. For example,
4 // its address may be taken and it may be written to indirectly. Ensure that MIRI can handle this.
6 #![feature(const_mut_refs)]
8 #[inline(never)] // Try to ensure that MIR optimizations don't optimize this away.
9 const fn init(buf: &mut [u8; 1024]) {
14 const fn nrvo() -> [u8; 1024] {
15 let mut buf = [0; 1024];
20 const BUF: [u8; 1024] = nrvo();
23 assert_eq!(BUF[33], 3);
24 assert_eq!(BUF[19], 0);
25 assert_eq!(BUF[444], 4);