Skip to content

Commit 1deaaa6

Browse files
Don't unleash NRVO const-eval test
1 parent 2fe1170 commit 1deaaa6

File tree

2 files changed

+8
-32
lines changed

2 files changed

+8
-32
lines changed

src/test/ui/consts/miri_unleashed/nrvo.rs renamed to src/test/ui/consts/const-eval/nrvo.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
1-
// compile-flags: -Zunleash-the-miri-inside-of-you
21
// run-pass
32

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.
5+
6+
#![feature(const_mut_refs)]
7+
8+
#[inline(never)] // Try to ensure that MIR optimizations don't optimize this away.
49
const fn init(buf: &mut [u8; 1024]) {
510
buf[33] = 3;
611
buf[444] = 4;
712
}
813

9-
const fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] {
14+
const fn nrvo() -> [u8; 1024] {
1015
let mut buf = [0; 1024];
1116
init(&mut buf);
1217
buf
1318
}
1419

15-
// When the NRVO is applied, the return place (`_0`) gets treated like a normal local. For example,
16-
// its address may be taken and it may be written to indirectly. Ensure that MIRI can handle this.
17-
const BUF: [u8; 1024] = nrvo(init);
20+
const BUF: [u8; 1024] = nrvo();
1821

1922
fn main() {
2023
assert_eq!(BUF[33], 3);

src/test/ui/consts/miri_unleashed/nrvo.stderr

-27
This file was deleted.

0 commit comments

Comments
 (0)