Closed
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
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.