Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
skmendez opened this issue Jun 4, 2021 · 4 comments · Fixed by #86223
Closed

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

skmendez opened this issue Jun 4, 2021 · 4 comments · Fixed by #86223
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users.

Comments

@skmendez
Copy link

skmendez commented Jun 4, 2021

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.

@skmendez skmendez added the C-bug Category: This is a bug. label Jun 4, 2021
@skmendez skmendez changed the title The meaning of "item signatures" in E0121 should be elaborated on The meaning of an "item" in E0121 should be elaborated on Jun 4, 2021
@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. and removed C-bug Category: This is a bug. labels Jun 4, 2021
@inquisitivecrystal
Copy link
Contributor

@rustbot label +D-confusing +D-newcomer-roadblock

@rustbot rustbot added D-confusing Diagnostics: Confusing error or lint that should be reworked. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. labels Jun 5, 2021
@fee1-dead
Copy link
Member

@rustbot claim

@fee1-dead fee1-dead removed their assignment Jun 6, 2021
@skmendez
Copy link
Author

skmendez commented Jun 8, 2021

Now that I'm looking at it, a lot of errors use the term item, but place I can find a definition for what's an item is in in the Rust Reference. I don't think that understanding terms used for the syntax of Rust should be required to comprehend an error message; as it stands I think it would be reasonable for a Rust newcomer to assume that an "item" could be any statement including variable assignment.

@fee1-dead
Copy link
Member

@rustbot claim

JohnTitor added a commit to JohnTitor/rust that referenced this issue Jun 21, 2021
fee1-dead added a commit to fee1-dead-contrib/rust that referenced this issue Jun 22, 2021
@bors bors closed this as completed in af9e5d1 Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. D-confusing Diagnostics: Confusing error or lint that should be reworked. D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants