about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-18 23:06:08 +0000
committerbors <bors@rust-lang.org>2020-04-18 23:06:08 +0000
commit8001b96f48d2c9cd646acd2d16f4e06078f258e1 (patch)
treebd9f95bbb95f86af5bbcc37ed489947b5a19da87 /src/test
parent52fa23add6fb0776b32cc591ac928618391bdf41 (diff)
parentf6fb931d4f7ea3fae270e16d29a16bca09b17b7d (diff)
downloadrust-8001b96f48d2c9cd646acd2d16f4e06078f258e1.tar.gz
rust-8001b96f48d2c9cd646acd2d16f4e06078f258e1.zip
Auto merge of #71306 - Dylan-DPC:rollup-kvzc1da, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #71271 (Move `MapInPlace` to rustc_data_structures)
 - #71276 (miri-unleashed: test that we detect heap allocations)
 - #71283 (Minor improvements to -Zprofile)
 - #71287 (Explain why we shouldn't add inline attr to into_vec)
 - #71303 (remove build warnings)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/consts/miri_unleashed/box.rs14
-rw-r--r--src/test/ui/consts/miri_unleashed/box.stderr15
2 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/consts/miri_unleashed/box.rs b/src/test/ui/consts/miri_unleashed/box.rs
new file mode 100644
index 00000000000..049727684d0
--- /dev/null
+++ b/src/test/ui/consts/miri_unleashed/box.rs
@@ -0,0 +1,14 @@
+// compile-flags: -Zunleash-the-miri-inside-of-you
+#![feature(const_mut_refs, box_syntax)]
+#![deny(const_err)]
+
+use std::mem::ManuallyDrop;
+
+fn main() {}
+
+static TEST_BAD: &mut i32 = {
+    &mut *(box 0)
+    //~^ WARN skipping const check
+    //~| ERROR could not evaluate static initializer
+    //~| NOTE heap allocations
+};
diff --git a/src/test/ui/consts/miri_unleashed/box.stderr b/src/test/ui/consts/miri_unleashed/box.stderr
new file mode 100644
index 00000000000..d1b404ea737
--- /dev/null
+++ b/src/test/ui/consts/miri_unleashed/box.stderr
@@ -0,0 +1,15 @@
+warning: skipping const checks
+  --> $DIR/box.rs:10:11
+   |
+LL |     &mut *(box 0)
+   |           ^^^^^^^
+
+error[E0080]: could not evaluate static initializer
+  --> $DIR/box.rs:10:11
+   |
+LL |     &mut *(box 0)
+   |           ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants
+
+error: aborting due to previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0080`.