]>
git.proxmox.com Git - rustc.git/blob - tests/ui/consts/const-eval/nrvo.rs
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 the const-eval
5 // interpreter can handle this.
7 #![feature(const_mut_refs)]
9 #[inline(never)] // Try to ensure that MIR optimizations don't optimize this away.
10 const fn init(buf
: &mut [u8; 1024]) {
15 const fn nrvo() -> [u8; 1024] {
16 let mut buf
= [0; 1024];
21 const BUF
: [u8; 1024] = nrvo();
24 assert_eq
!(BUF
[33], 3);
25 assert_eq
!(BUF
[19], 0);
26 assert_eq
!(BUF
[444], 4);