Skip to content

Const generic ICE: constant in type had an ignored error: TooGeneric #66962

@qwerty19106

Description

@qwerty19106

Environment:

note: rustc 1.41.0-nightly (4007d4ef2 2019-12-01) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

The code:

#![feature(const_generics)]

#[derive(PartialEq, Eq)]
struct Config {
    arr_size: usize
}

struct B<const CFG: Config> {
    arr: [u8; {CFG.arr_size}]
}

fn main() {
}

gives ICE:

error: internal compiler error: constant in type had an ignored error: TooGeneric

Playground

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)F-const_generics`#![feature(const_generics)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions