Skip to content

ICE with Const Generic expression inside array declaration #60619

Closed
@sfleischman105

Description

@sfleischman105

Found an ICE with the following code:

pub struct Foo<const LEN: usize> {
    buf: [u8; {LEN * 2}]
}

Results in "no errors encountered even though delay_span_bug issued" on current nightly.

Playground link.

The ICE still happens regardless of the LEN * 2 being in a block, in parenthesis, or even as a standalone expression. Interestingly, refactoring out the array into a seperate struct solves the issue.

cc @varkor @yodaldevoid

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)A-lazy-normalizationArea: Lazy normalization (tracking issue: #60471)C-bugCategory: This is a bug.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