Skip to content

Check existing uses of unwrap_usize for ty::Array #61381

Closed
@varkor

Description

@varkor

Generally, we should be using assert_usize, which will fail gracefully if we have a generic parameter as an array length instead, and handling that case specially. Using unwrap_usize has caused issues in the past: #61380.

ICEs resulting from this issue have the form:

error: internal compiler error: src/librustc/ty/sty.rs:2311: expected constant usize, got Const {
    ty: usize,
    val: Param(
        N/#0,
    ),
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-enhancementCategory: An issue proposing an enhancement or a PR with one.F-const_generics`#![feature(const_generics)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.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