Skip to content

E0308 type mismatch for arrays doens't offer to fix the length (unlike E0658) #107156

Closed
@lnicola

Description

@lnicola

Code

const NUMBERS: [u8; 3] = [10, 20];

Current output

  |
7 | const NUMBERS: [u8; 3] = [10, 20];
  |                          ^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements

Desired output

  |
7 | const NUMBERS: [u8; 3] = [10, 20];
  |                     ^ help: consider specifying the array length: `2`
  |

Rationale and extra context

Works nicer in an IDE.

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions