Skip to content

The meaning of an "item" in E0121 should be elaborated on #86005

Closed
@skmendez

Description

@skmendez

I tried this code:

fn main() {
    const BAD: [_; 3] = [1u8, 2u8, 3u8];
}

I expected to see this happen: an error which explains why this doesn't work with const even though it does work with let, like what would happen with the code:

fn main() {
    const BAD = 1u8;
}

Instead, this happened: E0121, which doesn't explain that the problem is that const's need to be explicitly typed, but instead refers to an "item signature", which is an unexplained term of art. The explanation in rustc --explain E0121 does not elaborate on what an "item signature" means either.

Meta

rustc --version --verbose:
Occurs on 1.52.1 stable and on 1.54.0 nightly.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions