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

Add note on attempts of using Self as a normal generic arg #89985

Closed
hkmatsumoto opened this issue Oct 17, 2021 · 1 comment · Fixed by #90022
Closed

Add note on attempts of using Self as a normal generic arg #89985

hkmatsumoto opened this issue Oct 17, 2021 · 1 comment · Fixed by #90022
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hkmatsumoto
Copy link
Member

hkmatsumoto commented Oct 17, 2021

Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=53b02445623677643befa3e7dbe0f3b4

fn foo<Self>() {}

The current output is:

error: expected identifier, found keyword `Self`
 --> src/lib.rs:1:8
  |
1 | fn foo<Self>() {}
  |        ^^^^ expected identifier, found keyword

The diagnostic itself is right but confusing; it lacks why Self is a reserved keyword (IIUC it's because Self is special-cased to represent traits or ADTs in its implementations).

@hkmatsumoto hkmatsumoto added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 17, 2021
@hkmatsumoto
Copy link
Member Author

@rustbot claim

@hkmatsumoto hkmatsumoto added D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. P-low Low priority labels Oct 18, 2021
@bors bors closed this as completed in 29fe57d Dec 5, 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 D-newcomer-roadblock Diagnostics: Confusing error or lint; hard to understand for new users. P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant