From 4fe4ff95f6c459d98c2449c9993e0f7e0b8c47d3 Mon Sep 17 00:00:00 2001 From: Smitty Date: Tue, 15 Jun 2021 19:16:10 -0400 Subject: 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. --- src/test/ui/consts/control-flow/assert.const_panic.stderr | 6 ++---- src/test/ui/consts/control-flow/assert.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/test/ui/consts/control-flow') 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() {} -- cgit 1.4.1-3-g733a5