Skip to content

Array size calculation fails with as usize for length #21165

@crumblingstatue

Description

@crumblingstatue

rust-analyzer version: rust-analyzer version: 0.4.2699-standalone

rustc version: rustc 1.93.0-nightly (cc3eee7fb 2025-11-28)

editor or extension: VSCode (RA plugin: 0.4.2699 [pre-release])

const NUM: u8 = 16;

struct My {
    array: [u8; NUM as usize],
}

Layout information will not be available for the field (or struct).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions