Skip to content

Const generics ICE: trying to create const name for unexpected const #61747

Closed
@jplatte

Description

This code (playground):

#![feature(const_generics)]

struct Const<const N: usize>;

impl<const C: usize> Const<{C}> {
    fn successor() -> Const<{C + 1}> {
        Const
    }
}

fn main() {
    Const::<1>::successor();
}

results in an ICE:

error: internal compiler error: src/librustc/ty/print/obsolete.rs:201: DefPathBasedNames: trying to create const name for unexpected const: Const { ty: usize, val: Unevaluated(DefId(0:19 ~ playground[e6be]::{{impl}}[0]::successor[0]::{{constant}}[0]), []) }

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:637:9

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.F-const_generics`#![feature(const_generics)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions