diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-05-17 10:23:44 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2020-05-17 10:23:44 -0700 |
| commit | 1deaaa610c949a123751b76302b5cec7e7a1c664 (patch) | |
| tree | 210a36830930989c450c5c984384ff64735f8caa | |
| parent | 2fe117061331215e9fa899983f1ca121bba619ec (diff) | |
| download | rust-1deaaa610c949a123751b76302b5cec7e7a1c664.tar.gz rust-1deaaa610c949a123751b76302b5cec7e7a1c664.zip | |
Don't unleash NRVO const-eval test
| -rw-r--r-- | src/test/ui/consts/const-eval/nrvo.rs (renamed from src/test/ui/consts/miri_unleashed/nrvo.rs) | 13 | ||||
| -rw-r--r-- | src/test/ui/consts/miri_unleashed/nrvo.stderr | 27 |
2 files changed, 8 insertions, 32 deletions
diff --git a/src/test/ui/consts/miri_unleashed/nrvo.rs b/src/test/ui/consts/const-eval/nrvo.rs index b7f11024805..1d2c6acc06c 100644 --- a/src/test/ui/consts/miri_unleashed/nrvo.rs +++ b/src/test/ui/consts/const-eval/nrvo.rs @@ -1,20 +1,23 @@ -// compile-flags: -Zunleash-the-miri-inside-of-you // run-pass +// When the NRVO is applied, the return place (`_0`) gets treated like a normal local. For example, +// its address may be taken and it may be written to indirectly. Ensure that MIRI can handle this. + +#![feature(const_mut_refs)] + +#[inline(never)] // Try to ensure that MIR optimizations don't optimize this away. const fn init(buf: &mut [u8; 1024]) { buf[33] = 3; buf[444] = 4; } -const fn nrvo(init: fn(&mut [u8; 1024])) -> [u8; 1024] { +const fn nrvo() -> [u8; 1024] { let mut buf = [0; 1024]; init(&mut buf); buf } -// When the NRVO is applied, the return place (`_0`) gets treated like a normal local. For example, -// its address may be taken and it may be written to indirectly. Ensure that MIRI can handle this. -const BUF: [u8; 1024] = nrvo(init); +const BUF: [u8; 1024] = nrvo(); fn main() { assert_eq!(BUF[33], 3); diff --git a/src/test/ui/consts/miri_unleashed/nrvo.stderr b/src/test/ui/consts/miri_unleashed/nrvo.stderr deleted file mode 100644 index d38f869181b..00000000000 --- a/src/test/ui/consts/miri_unleashed/nrvo.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: skipping const checks - | -help: skipping check for `const_mut_refs` feature - --> $DIR/nrvo.rs:5:5 - | -LL | buf[33] = 3; - | ^^^^^^^^^^^ -help: skipping check for `const_mut_refs` feature - --> $DIR/nrvo.rs:6:5 - | -LL | buf[444] = 4; - | ^^^^^^^^^^^^ -help: skipping check for `const_mut_refs` feature - --> $DIR/nrvo.rs:11:10 - | -LL | init(&mut buf); - | ^^^^^^^^ -help: skipping check that does not even have a feature gate - --> $DIR/nrvo.rs:11:5 - | -LL | init(&mut buf); - | ^^^^^^^^^^^^^^ - -error: `-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature gates, except when testing error paths in the CTFE engine - -error: aborting due to previous error; 1 warning emitted - |
