add comment and bless some tests

This commit is contained in:
Vishnunarayan K I 2020-12-02 17:19:11 +05:30
parent a6c4cbd46a
commit 1b7fe09025
11 changed files with 242 additions and 140 deletions

View File

@ -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);
}

View File

@ -11,12 +11,6 @@ LL | if std::mem::size_of::<T>() == 0 {
LL | pub const fn size_of<T>() -> 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::<T>()],
| ^^^^^^^^^^^^^ 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<T>,
| ^^^^ ^
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`.

View File

@ -18,7 +18,6 @@ pub struct AtLeastByte<T: ?Sized> {
//~^ ERROR the size for values of type `T` cannot be known at compilation time
pad: [u8; is_zst::<T>()],
//[min]~^ ERROR generic parameters may not be used in const operations
//[full]~^^ ERROR evaluation of constant value failed
}
fn main() {}

View File

@ -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::<T>::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::<i32>` at $DIR/erroneous-const.rs:12:17
...
LL | pub static FOO: () = no_codegen::<i32>();
| ^^^^^^^^^^^^^^^^^^^ 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`.

View File

@ -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() {

View File

@ -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`.

View File

@ -14,11 +14,6 @@ note: ...which requires const-evaluating + checking `Foo::bytes::{constant#0}`..
|
LL | bytes: [u8; std::mem::size_of::<Foo>()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
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<T>() -> 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

View File

@ -1,15 +1,15 @@
// build-fail
pub const unsafe fn fake_type<T>() -> 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<T> Const for T {}

View File

@ -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::<i32>` 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::<i32>` at $DIR/uninhabited-const-issue-61744.rs:4:5
| inside `<i32 as Const>::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`.

View File

@ -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()

View File

@ -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`.