-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
This code causes an ICE starting from Rust 1.41.0 (stable, beta, and nightly):
enum Enum {
A(),
}
impl Enum {
const fn a() -> Self {
return Self::A();
}
}
pub fn main() {
const A: Enum = Enum::a();
}
Error:
error: internal compiler error: src/librustc_typeck/check/mod.rs:995: can't type-check body of DefId(0:5 ~ main[2fbc]::Enum[0]::A[0]::{{constructor}}[0])
--> main.rs:2:5
|
2 | A(),
| ^^^
No extra flags were added. It also happens in release mode.
rustc main.rs
Rust Playground is at version 1.40.0 and doesn't have the error on stable:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6683265b3123c0a6835431de2f0c6897
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, ...)C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityHigh priorityT-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.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.