-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.
Description
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 lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.