-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
const fn foo() {
const { foo() };
}
Current output
Compiling playground v0.0.1 (/playground)
error[E0391]: cycle detected when elaborating drops for `foo`
--> src/lib.rs:2:5
|
2 | const { foo() };
| ^^^^^^^^^^^^^^^
|
note: ...which requires simplifying constant for the type system `foo::{constant#0}`...
--> src/lib.rs:2:5
|
2 | const { foo() };
| ^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `foo::{constant#0}`...
--> src/lib.rs:2:5
|
2 | const { foo() };
| ^^^^^^^^^^^^^^^
note: ...which requires caching mir of `foo` for CTFE...
--> src/lib.rs:1:1
|
1 | const fn foo() {
| ^^^^^^^^^^^^^^
= note: ...which again requires elaborating drops for `foo`, completing the cycle
= note: cycle used when running analysis passes on this crate
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
For more information about this error, try `rustc --explain E0391`.
error: could not compile `playground` (lib) due to 1 previous error
Desired output
Something about constant evaluation failing.
Rationale and extra context
No response
Other cases
No response
Rust Version
Nightly rustc on the playground
1.80.0-nightly (2024-05-28 da159eb331b27df52818)
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.