From 1b7fe09025f6dfc7f134243fd672ad2c490b466b Mon Sep 17 00:00:00 2001 From: Vishnunarayan K I Date: Wed, 2 Dec 2020 17:19:11 +0530 Subject: [PATCH] add comment and bless some tests --- compiler/rustc_mir/src/const_eval/machine.rs | 6 +- .../const-argument-if-length.full.stderr | 11 +- .../const-argument-if-length.rs | 1 - .../consts/const-eval/erroneous-const.stderr | 16 +- src/test/ui/consts/const-eval/unwind-abort.rs | 4 +- .../ui/consts/const-eval/unwind-abort.stderr | 23 ++- src/test/ui/consts/const-size_of-cycle.stderr | 5 - .../consts/uninhabited-const-issue-61744.rs | 6 +- .../uninhabited-const-issue-61744.stderr | 151 ++++++++--------- .../infinite/infinite-recursion-const-fn.rs | 3 +- .../infinite-recursion-const-fn.stderr | 156 ++++++++++++++++-- 11 files changed, 242 insertions(+), 140 deletions(-) diff --git a/compiler/rustc_mir/src/const_eval/machine.rs b/compiler/rustc_mir/src/const_eval/machine.rs index 6449b7cdebc..29bc14be74d 100644 --- a/compiler/rustc_mir/src/const_eval/machine.rs +++ b/compiler/rustc_mir/src/const_eval/machine.rs @@ -38,7 +38,11 @@ impl<'mir, 'tcx> InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>> { if instance.def.requires_caller_location(self.tcx()) { return Ok(false); } - // only memoize instrinsics + // Only memoize instrinsics. This was added in #79594 while adding the `const_allocate` intrinsic. + // We only memoize intrinsics because it would be unsound to memoize functions + // which might interact with the heap. + // Additionally, const_allocate intrinsic is impure and thus should not be memoized; + // it will not be memoized because it has non-ZST args if !matches!(instance.def, InstanceDef::Intrinsic(_)) { return Ok(false); } diff --git a/src/test/ui/const-generics/const-argument-if-length.full.stderr b/src/test/ui/const-generics/const-argument-if-length.full.stderr index 9b1c1be1aa0..4d627f05adc 100644 --- a/src/test/ui/const-generics/const-argument-if-length.full.stderr +++ b/src/test/ui/const-generics/const-argument-if-length.full.stderr @@ -11,12 +11,6 @@ LL | if std::mem::size_of::() == 0 { LL | pub const fn size_of() -> usize { | - required by this bound in `std::mem::size_of` -error[E0080]: evaluation of constant value failed - --> $DIR/const-argument-if-length.rs:19:15 - | -LL | pad: [u8; is_zst::()], - | ^^^^^^^^^^^^^ referenced constant has errors - error[E0277]: the size for values of type `T` cannot be known at compilation time --> $DIR/const-argument-if-length.rs:17:12 | @@ -36,7 +30,6 @@ help: the `Box` type always has a statically known size and allocates its conten LL | value: Box, | ^^^^ ^ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0080, E0277. -For more information about an error, try `rustc --explain E0080`. +For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/const-argument-if-length.rs b/src/test/ui/const-generics/const-argument-if-length.rs index a8bffd17b91..80907383124 100644 --- a/src/test/ui/const-generics/const-argument-if-length.rs +++ b/src/test/ui/const-generics/const-argument-if-length.rs @@ -18,7 +18,6 @@ pub struct AtLeastByte { //~^ ERROR the size for values of type `T` cannot be known at compilation time pad: [u8; is_zst::()], //[min]~^ ERROR generic parameters may not be used in const operations - //[full]~^^ ERROR evaluation of constant value failed } fn main() {} diff --git a/src/test/ui/consts/const-eval/erroneous-const.stderr b/src/test/ui/consts/const-eval/erroneous-const.stderr index 7087a6f668c..040cc3fcf79 100644 --- a/src/test/ui/consts/const-eval/erroneous-const.stderr +++ b/src/test/ui/consts/const-eval/erroneous-const.stderr @@ -24,18 +24,18 @@ note: the lint level is defined here LL | #![warn(const_err, unconditional_panic)] | ^^^^^^^^^ -error[E0080]: evaluation of constant value failed +error[E0080]: could not evaluate static initializer --> $DIR/erroneous-const.rs:12:17 | LL | let _ = PrintName::::VOID; - | ^^^^^^^^^^^^^^^^^^^^ referenced constant has errors - -error[E0080]: could not evaluate static initializer - --> $DIR/erroneous-const.rs:16:22 - | + | ^^^^^^^^^^^^^^^^^^^^ + | | + | referenced constant has errors + | inside `no_codegen::` at $DIR/erroneous-const.rs:12:17 +... LL | pub static FOO: () = no_codegen::(); - | ^^^^^^^^^^^^^^^^^^^ referenced constant has errors + | ------------------- inside `FOO` at $DIR/erroneous-const.rs:16:22 -error: aborting due to 2 previous errors; 2 warnings emitted +error: aborting due to previous error; 2 warnings emitted For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-eval/unwind-abort.rs b/src/test/ui/consts/const-eval/unwind-abort.rs index b8b95dea1e7..b9e63e2fa20 100644 --- a/src/test/ui/consts/const-eval/unwind-abort.rs +++ b/src/test/ui/consts/const-eval/unwind-abort.rs @@ -2,10 +2,10 @@ #[unwind(aborts)] const fn foo() { - panic!() //~ evaluation of constant value failed + panic!() //~ 5:13: any use of this value will cause an error [const_err] } -const _: () = foo(); //~ any use of this value will cause an error +const _: () = foo(); // Ensure that the CTFE engine handles calls to `#[unwind(aborts)]` gracefully fn main() { diff --git a/src/test/ui/consts/const-eval/unwind-abort.stderr b/src/test/ui/consts/const-eval/unwind-abort.stderr index 084beb19eb9..eee1a35a0dc 100644 --- a/src/test/ui/consts/const-eval/unwind-abort.stderr +++ b/src/test/ui/consts/const-eval/unwind-abort.stderr @@ -1,21 +1,18 @@ -error[E0080]: evaluation of constant value failed +error: any use of this value will cause an error --> $DIR/unwind-abort.rs:5:5 | LL | panic!() - | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:5:5 - | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - -error: any use of this value will cause an error - --> $DIR/unwind-abort.rs:8:15 - | + | ^^^^^^^^ + | | + | the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:5:5 + | inside `foo` at $SRC_DIR/std/src/macros.rs:LL:COL + | inside `_` at $DIR/unwind-abort.rs:8:15 +... LL | const _: () = foo(); - | --------------^^^^^- - | | - | referenced constant has errors + | -------------------- | = note: `#[deny(const_err)]` on by default + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr index fdbe3f0c592..129457ebdf9 100644 --- a/src/test/ui/consts/const-size_of-cycle.stderr +++ b/src/test/ui/consts/const-size_of-cycle.stderr @@ -14,11 +14,6 @@ note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`.. | LL | bytes: [u8; std::mem::size_of::()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -note: ...which requires const-evaluating + checking `std::mem::size_of`... - --> $SRC_DIR/core/src/mem/mod.rs:LL:COL - | -LL | pub const fn size_of() -> usize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: ...which requires computing layout of `Foo`... = note: ...which requires normalizing `[u8; _]`... = note: ...which again requires simplifying constant for the type system `Foo::bytes::{constant#0}`, completing the cycle diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.rs b/src/test/ui/consts/uninhabited-const-issue-61744.rs index 15436f9c1b2..7fb1dc988bb 100644 --- a/src/test/ui/consts/uninhabited-const-issue-61744.rs +++ b/src/test/ui/consts/uninhabited-const-issue-61744.rs @@ -1,15 +1,15 @@ // build-fail pub const unsafe fn fake_type() -> T { - hint_unreachable() + hint_unreachable() //~ 4:23: any use of this value will cause an error [const_err] } pub const unsafe fn hint_unreachable() -> ! { - fake_type() //~ ERROR evaluation of constant value failed + fake_type() } trait Const { - const CONSTANT: i32 = unsafe { fake_type() }; //~ ERROR any use of this value will cause an err + const CONSTANT: i32 = unsafe { fake_type() }; } impl Const for T {} diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.stderr b/src/test/ui/consts/uninhabited-const-issue-61744.stderr index 024f9782d4a..1fb5ac11df0 100644 --- a/src/test/ui/consts/uninhabited-const-issue-61744.stderr +++ b/src/test/ui/consts/uninhabited-const-issue-61744.stderr @@ -1,150 +1,141 @@ -error[E0080]: evaluation of constant value failed - --> $DIR/uninhabited-const-issue-61744.rs:8:5 +error: any use of this value will cause an error + --> $DIR/uninhabited-const-issue-61744.rs:4:5 | LL | hint_unreachable() - | ------------------ - | | - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 - | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 -... -LL | fake_type() - | ^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^ | | | reached the configured maximum number of stack frames + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5 - -error: any use of this value will cause an error - --> $DIR/uninhabited-const-issue-61744.rs:12:36 - | + | inside `fake_type::` at $DIR/uninhabited-const-issue-61744.rs:4:5 + | inside `::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:12:36 +... LL | const CONSTANT: i32 = unsafe { fake_type() }; - | -------------------------------^^^^^^^^^^^--- - | | - | referenced constant has errors + | --------------------------------------------- | = note: `#[deny(const_err)]` on by default @@ -154,6 +145,6 @@ error[E0080]: erroneous constant used LL | dbg!(i32::CONSTANT); | ^^^^^^^^^^^^^ referenced constant has errors -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.rs b/src/test/ui/infinite/infinite-recursion-const-fn.rs index 34580407926..2e812dc53a6 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.rs +++ b/src/test/ui/infinite/infinite-recursion-const-fn.rs @@ -1,8 +1,7 @@ //https://github.com/rust-lang/rust/issues/31364 const fn a() -> usize { - //~^ ERROR cycle detected when const-evaluating + checking `a` [E0391] - b() + b() //~ 4:8: evaluation of constant value failed [E0080] } const fn b() -> usize { a() diff --git a/src/test/ui/infinite/infinite-recursion-const-fn.stderr b/src/test/ui/infinite/infinite-recursion-const-fn.stderr index 7ccc7cc987f..620c9e110ff 100644 --- a/src/test/ui/infinite/infinite-recursion-const-fn.stderr +++ b/src/test/ui/infinite/infinite-recursion-const-fn.stderr @@ -1,21 +1,145 @@ -error[E0391]: cycle detected when const-evaluating + checking `a` - --> $DIR/infinite-recursion-const-fn.rs:3:1 - | -LL | const fn a() -> usize { - | ^^^^^^^^^^^^^^^^^^^^^ - | -note: ...which requires const-evaluating + checking `b`... - --> $DIR/infinite-recursion-const-fn.rs:7:1 - | -LL | const fn b() -> usize { - | ^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires const-evaluating + checking `a`, completing the cycle -note: cycle used when const-evaluating + checking `ARR::{constant#0}` - --> $DIR/infinite-recursion-const-fn.rs:10:18 +error[E0080]: evaluation of constant value failed + --> $DIR/infinite-recursion-const-fn.rs:4:5 | +LL | b() + | ^^^ + | | + | reached the configured maximum number of stack frames + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 + | inside `a` at $DIR/infinite-recursion-const-fn.rs:4:5 +... +LL | a() + | --- + | | + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 + | inside `b` at $DIR/infinite-recursion-const-fn.rs:7:5 +LL | } LL | const ARR: [i32; a()] = [5; 6]; - | ^^^ + | --- inside `ARR::{constant#0}` at $DIR/infinite-recursion-const-fn.rs:9:18 error: aborting due to previous error -For more information about this error, try `rustc --explain E0391`. +For more information about this error, try `rustc --explain E0080`.