about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSmitty <me@smitop.com>2021-06-15 18:24:39 -0400
committerSmitty <me@smitop.com>2021-06-29 19:08:29 -0400
commitdc1c6c3a253482574d796f5cec4250f323724620 (patch)
treed54d05e48b7d019618d19fe63072f8204312c39e
parentb40f3c10609a6f456f9a7c81fa9d49e22c10e3bc (diff)
downloadrust-dc1c6c3a253482574d796f5cec4250f323724620.tar.gz
rust-dc1c6c3a253482574d796f5cec4250f323724620.zip
Make memory exhaustion a hard error
-rw-r--r--compiler/rustc_middle/src/mir/interpret/error.rs3
-rw-r--r--src/test/ui/consts/large_const_alloc.rs3
-rw-r--r--src/test/ui/consts/large_const_alloc.stderr17
3 files changed, 7 insertions, 16 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs
index 137a0bb77e3..ab9239585c4 100644
--- a/compiler/rustc_middle/src/mir/interpret/error.rs
+++ b/compiler/rustc_middle/src/mir/interpret/error.rs
@@ -530,7 +530,8 @@ impl InterpError<'_> {
         use InterpError::*;
         match *self {
             MachineStop(ref err) => err.is_hard_err(),
-            InterpError::UndefinedBehavior(_) => true,
+            UndefinedBehavior(_) => true,
+            ResourceExhaustion(ResourceExhaustionInfo::MemoryExhausted) => true,
             _ => false,
         }
     }
diff --git a/src/test/ui/consts/large_const_alloc.rs b/src/test/ui/consts/large_const_alloc.rs
index d5c90c0d6cf..2771af92d30 100644
--- a/src/test/ui/consts/large_const_alloc.rs
+++ b/src/test/ui/consts/large_const_alloc.rs
@@ -4,8 +4,7 @@
 const FOO: () = {
     // 128 TiB, unlikely anyone has that much RAM
     let x = [0_u8; (1 << 47) - 1];
-    //~^ ERROR any use of this value will cause an error
-    //~| WARNING this was previously accepted by the compiler but is being phased out
+    //~^ ERROR evaluation of constant value failed
 };
 
 fn main() {
diff --git a/src/test/ui/consts/large_const_alloc.stderr b/src/test/ui/consts/large_const_alloc.stderr
index bf05cdb4a1d..54d56a42061 100644
--- a/src/test/ui/consts/large_const_alloc.stderr
+++ b/src/test/ui/consts/large_const_alloc.stderr
@@ -1,18 +1,9 @@
-error: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/large_const_alloc.rs:6:13
    |
-LL | / const FOO: () = {
-LL | |     // 128 TiB, unlikely anyone has that much RAM
-LL | |     let x = [0_u8; (1 << 47) - 1];
-   | |             ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
-LL | |
-LL | |
-LL | | };
-   | |__-
-   |
-   = note: `#[deny(const_err)]` on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
+LL |     let x = [0_u8; (1 << 47) - 1];
+   |             ^^^^^^^^^^^^^^^^^^^^^ tried to allocate more memory than available to compiler
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0080`.