about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSmitty <me@smitop.com>2021-06-15 19:16:10 -0400
committerSmitty <me@smitop.com>2021-06-15 19:16:10 -0400
commit4fe4ff95f6c459d98c2449c9993e0f7e0b8c47d3 (patch)
tree50d71e1f2f95ac40297f3a0c4d0563cc0cfdb4e1
parent60f1a2fc4b535ead9c85ce085fdce49b1b097531 (diff)
downloadrust-4fe4ff95f6c459d98c2449c9993e0f7e0b8c47d3.tar.gz
rust-4fe4ff95f6c459d98c2449c9993e0f7e0b8c47d3.zip
Use better error message for hard errors in CTFE
Currently the same message is used for hard errors and soft errors. This
makes hard errors use a message that indicates the reality of the
situation correctly, since usage of the constant is never allowed when
there was a hard error evaluating it.
-rw-r--r--compiler/rustc_mir/src/const_eval/error.rs8
-rw-r--r--compiler/rustc_mir/src/const_eval/eval_queries.rs5
-rw-r--r--src/test/ui/consts/const-eval/const_panic.rs20
-rw-r--r--src/test/ui/consts/const-eval/const_panic.stderr60
-rw-r--r--src/test/ui/consts/const-eval/const_panic_libcore_bin.rs6
-rw-r--r--src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr18
-rw-r--r--src/test/ui/consts/const-eval/panic-assoc-never-type.rs2
-rw-r--r--src/test/ui/consts/const-eval/panic-assoc-never-type.stderr6
-rw-r--r--src/test/ui/consts/const-eval/panic-never-type.rs2
-rw-r--r--src/test/ui/consts/const-eval/panic-never-type.stderr6
-rw-r--r--src/test/ui/consts/const-eval/unwind-abort.rs2
-rw-r--r--src/test/ui/consts/const-eval/unwind-abort.stderr5
-rw-r--r--src/test/ui/consts/const-unwrap.stderr7
-rw-r--r--src/test/ui/consts/control-flow/assert.const_panic.stderr6
-rw-r--r--src/test/ui/consts/control-flow/assert.rs2
15 files changed, 58 insertions, 97 deletions
diff --git a/compiler/rustc_mir/src/const_eval/error.rs b/compiler/rustc_mir/src/const_eval/error.rs
index fc21047ab72..17e8ab2a4da 100644
--- a/compiler/rustc_mir/src/const_eval/error.rs
+++ b/compiler/rustc_mir/src/const_eval/error.rs
@@ -157,7 +157,7 @@ impl<'tcx> ConstEvalErr<'tcx> {
         tcx: TyCtxtAt<'tcx>,
         message: &str,
         emit: impl FnOnce(DiagnosticBuilder<'_>),
-        mut lint_root: Option<hir::HirId>,
+        lint_root: Option<hir::HirId>,
     ) -> ErrorHandled {
         let finish = |mut err: DiagnosticBuilder<'_>, span_msg: Option<String>| {
             trace!("reporting const eval failure at {:?}", self.span);
@@ -194,12 +194,6 @@ impl<'tcx> ConstEvalErr<'tcx> {
             _ => {}
         };
 
-        // If we have a 'hard error', then set `lint_root` to `None` so that we don't
-        // emit a lint.
-        if matches!(&self.error, InterpError::MachineStop(err) if err.is_hard_err()) {
-            lint_root = None;
-        }
-
         let err_msg = self.error.to_string();
 
         // Regular case - emit a lint.
diff --git a/compiler/rustc_mir/src/const_eval/eval_queries.rs b/compiler/rustc_mir/src/const_eval/eval_queries.rs
index 460fea37461..6adb6e34958 100644
--- a/compiler/rustc_mir/src/const_eval/eval_queries.rs
+++ b/compiler/rustc_mir/src/const_eval/eval_queries.rs
@@ -2,8 +2,8 @@ use super::{CompileTimeEvalContext, CompileTimeInterpreter, ConstEvalErr, Memory
 use crate::interpret::eval_nullary_intrinsic;
 use crate::interpret::{
     intern_const_alloc_recursive, Allocation, ConstAlloc, ConstValue, CtfeValidationMode, GlobalId,
-    Immediate, InternKind, InterpCx, InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking, Scalar,
-    ScalarMaybeUninit, StackPopCleanup,
+    Immediate, InternKind, InterpCx, InterpError, InterpResult, MPlaceTy, MemoryKind, OpTy,
+    RefTracking, Scalar, ScalarMaybeUninit, StackPopCleanup,
 };
 use crate::util::pretty::display_allocation;
 
@@ -315,6 +315,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
             let emit_as_lint = if let Some(def) = def.as_local() {
                 // (Associated) consts only emit a lint, since they might be unused.
                 matches!(tcx.def_kind(def.did.to_def_id()), DefKind::Const | DefKind::AssocConst)
+                    && !matches!(&err.error, InterpError::MachineStop(err) if err.is_hard_err())
             } else {
                 // use of broken constant from other crate: always an error
                 false
diff --git a/src/test/ui/consts/const-eval/const_panic.rs b/src/test/ui/consts/const-eval/const_panic.rs
index b33b1475a22..5807c5659b6 100644
--- a/src/test/ui/consts/const-eval/const_panic.rs
+++ b/src/test/ui/consts/const-eval/const_panic.rs
@@ -5,31 +5,31 @@
 const MSG: &str = "hello";
 
 const Z: () = std::panic!("cheese");
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const Z2: () = std::panic!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const Y: () = std::unreachable!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const X: () = std::unimplemented!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 //
 const W: () = std::panic!(MSG);
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const Z_CORE: () = core::panic!("cheese");
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const Z2_CORE: () = core::panic!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const Y_CORE: () = core::unreachable!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const X_CORE: () = core::unimplemented!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const W_CORE: () = core::panic!(MSG);
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/src/test/ui/consts/const-eval/const_panic.stderr
index 3c890f78af7..c0c749ede56 100644
--- a/src/test/ui/consts/const-eval/const_panic.stderr
+++ b/src/test/ui/consts/const-eval/const_panic.stderr
@@ -1,100 +1,80 @@
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:7:15
    |
 LL | const Z: () = std::panic!("cheese");
-   | --------------^^^^^^^^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15
+   |               ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:10:16
    |
 LL | const Z2: () = std::panic!();
-   | ---------------^^^^^^^^^^^^^-
-   |                |
-   |                the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16
+   |                ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:13:15
    |
 LL | const Y: () = std::unreachable!();
-   | --------------^^^^^^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15
+   |               ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:16:15
    |
 LL | const X: () = std::unimplemented!();
-   | --------------^^^^^^^^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15
+   |               ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:19:15
    |
 LL | const W: () = std::panic!(MSG);
-   | --------------^^^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15
+   |               ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:22:20
    |
 LL | const Z_CORE: () = core::panic!("cheese");
-   | -------------------^^^^^^^^^^^^^^^^^^^^^^-
-   |                    |
-   |                    the evaluated program panicked at 'cheese', $DIR/const_panic.rs:22:20
+   |                    ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:22:20
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:25:21
    |
 LL | const Z2_CORE: () = core::panic!();
-   | --------------------^^^^^^^^^^^^^^-
-   |                     |
-   |                     the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:25:21
+   |                     ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:25:21
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:28:20
    |
 LL | const Y_CORE: () = core::unreachable!();
-   | -------------------^^^^^^^^^^^^^^^^^^^^-
-   |                    |
-   |                    the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:28:20
+   |                    ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:28:20
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:31:20
    |
 LL | const X_CORE: () = core::unimplemented!();
-   | -------------------^^^^^^^^^^^^^^^^^^^^^^-
-   |                    |
-   |                    the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:31:20
+   |                    ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:31:20
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic.rs:34:20
    |
 LL | const W_CORE: () = core::panic!(MSG);
-   | -------------------^^^^^^^^^^^^^^^^^-
-   |                    |
-   |                    the evaluated program panicked at 'hello', $DIR/const_panic.rs:34:20
+   |                    ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:34:20
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs
index 6b03e847def..1ea0845c968 100644
--- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs
+++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs
@@ -7,13 +7,13 @@
 use core::panic::PanicInfo;
 
 const Z: () = panic!("cheese");
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const Y: () = unreachable!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 const X: () = unimplemented!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 #[lang = "eh_personality"]
 fn eh() {}
diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr
index 2a3ad3ca180..9abf8a20b8a 100644
--- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr
+++ b/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr
@@ -1,30 +1,24 @@
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_libcore_bin.rs:9:15
    |
 LL | const Z: () = panic!("cheese");
-   | --------------^^^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15
+   |               ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_libcore_bin.rs:12:15
    |
 LL | const Y: () = unreachable!();
-   | --------------^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15
+   |               ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/const_panic_libcore_bin.rs:15:15
    |
 LL | const X: () = unimplemented!();
-   | --------------^^^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15
+   |               ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs
index dd18a98035b..78cf25308ff 100644
--- a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs
+++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs
@@ -9,7 +9,7 @@ struct PrintName;
 
 impl PrintName {
     const VOID: ! = panic!();
-    //~^ ERROR any use of this value will cause an error
+    //~^ ERROR evaluation of constant value failed
 }
 
 fn main() {
diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
index e186240f53a..08560948309 100644
--- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -1,10 +1,8 @@
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/panic-assoc-never-type.rs:11:21
    |
 LL |     const VOID: ! = panic!();
-   |     ----------------^^^^^^^^-
-   |                     |
-   |                     the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21
+   |                     ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/consts/const-eval/panic-never-type.rs b/src/test/ui/consts/const-eval/panic-never-type.rs
index 71b489d828c..dd875768b16 100644
--- a/src/test/ui/consts/const-eval/panic-never-type.rs
+++ b/src/test/ui/consts/const-eval/panic-never-type.rs
@@ -4,7 +4,7 @@
 #![feature(never_type)]
 
 const VOID: ! = panic!();
-//~^ ERROR any use of this value will cause an error
+//~^ ERROR evaluation of constant value failed
 
 fn main() {
     let _ = VOID;
diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/src/test/ui/consts/const-eval/panic-never-type.stderr
index 2254c3dcfdf..9b7f2181c16 100644
--- a/src/test/ui/consts/const-eval/panic-never-type.stderr
+++ b/src/test/ui/consts/const-eval/panic-never-type.stderr
@@ -1,10 +1,8 @@
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/panic-never-type.rs:6:17
    |
 LL | const VOID: ! = panic!();
-   | ----------------^^^^^^^^-
-   |                 |
-   |                 the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17
+   |                 ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/consts/const-eval/unwind-abort.rs b/src/test/ui/consts/const-eval/unwind-abort.rs
index 9bc63d9328c..766a0c49be6 100644
--- a/src/test/ui/consts/const-eval/unwind-abort.rs
+++ b/src/test/ui/consts/const-eval/unwind-abort.rs
@@ -2,7 +2,7 @@
 
 #[unwind(aborts)]
 const fn foo() {
-    panic!() //~ ERROR any use of this value will cause an error
+    panic!() //~ ERROR evaluation of constant value failed
 }
 
 const _: () = foo();
diff --git a/src/test/ui/consts/const-eval/unwind-abort.stderr b/src/test/ui/consts/const-eval/unwind-abort.stderr
index b41d786169b..e3b871ee529 100644
--- a/src/test/ui/consts/const-eval/unwind-abort.stderr
+++ b/src/test/ui/consts/const-eval/unwind-abort.stderr
@@ -1,4 +1,4 @@
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/unwind-abort.rs:5:5
    |
 LL |     panic!()
@@ -6,10 +6,9 @@ LL |     panic!()
    |     |
    |     the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:5:5
    |     inside `foo` at $SRC_DIR/std/src/panic.rs:LL:COL
-   |     inside `_` at $DIR/unwind-abort.rs:8:15
 ...
 LL | const _: () = foo();
-   | --------------------
+   |               ----- inside `_` at $DIR/unwind-abort.rs:8:15
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/consts/const-unwrap.stderr b/src/test/ui/consts/const-unwrap.stderr
index 95f4711cb65..9a820ff7217 100644
--- a/src/test/ui/consts/const-unwrap.stderr
+++ b/src/test/ui/consts/const-unwrap.stderr
@@ -1,4 +1,4 @@
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $SRC_DIR/core/src/option.rs:LL:COL
    |
 LL |             None => panic!("called `Option::unwrap()` on a `None` value"),
@@ -6,12 +6,11 @@ LL |             None => panic!("called `Option::unwrap()` on a `None` value"),
    |                     |
    |                     the evaluated program panicked at 'called `Option::unwrap()` on a `None` value', $DIR/const-unwrap.rs:9:38
    |                     inside `Option::<i32>::unwrap` at $SRC_DIR/core/src/panic.rs:LL:COL
-   |                     inside `BAR` at $DIR/const-unwrap.rs:9:18
    | 
-  ::: $DIR/const-unwrap.rs:9:1
+  ::: $DIR/const-unwrap.rs:9:18
    |
 LL | const BAR: i32 = Option::<i32>::None.unwrap();
-   | ----------------------------------------------
+   |                  ---------------------------- inside `BAR` at $DIR/const-unwrap.rs:9:18
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/consts/control-flow/assert.const_panic.stderr b/src/test/ui/consts/control-flow/assert.const_panic.stderr
index 8e1a2b5eb46..1deaa937edb 100644
--- a/src/test/ui/consts/control-flow/assert.const_panic.stderr
+++ b/src/test/ui/consts/control-flow/assert.const_panic.stderr
@@ -1,10 +1,8 @@
-error[E0080]: any use of this value will cause an error
+error[E0080]: evaluation of constant value failed
   --> $DIR/assert.rs:10:15
    |
 LL | const _: () = assert!(false);
-   | --------------^^^^^^^^^^^^^^-
-   |               |
-   |               the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:10:15
+   |               ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:10:15
    |
    = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/src/test/ui/consts/control-flow/assert.rs b/src/test/ui/consts/control-flow/assert.rs
index 90017fee193..b311cb140cc 100644
--- a/src/test/ui/consts/control-flow/assert.rs
+++ b/src/test/ui/consts/control-flow/assert.rs
@@ -9,6 +9,6 @@ const _: () = assert!(true);
 
 const _: () = assert!(false);
 //[stock]~^ ERROR panicking in constants is unstable
-//[const_panic]~^^ ERROR any use of this value will cause an error
+//[const_panic]~^^ ERROR evaluation of constant value failed
 
 fn main() {}