-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Disallow Self in type param defaults of ADTs #64842
Disallow Self in type param defaults of ADTs #64842
Conversation
Some changes occurred in diagnostic error codes |
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
cc @alexreg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for writing the long error explanation when creating a new error code! Just a few minor changes and it should be good to go for me.
/me squints at their code I cannot tell if you're being sarcastic with your use of the word "long". . .but I'll take your thanks as genuine! No problem, happy to get my feet wet with diagnostics again! |
No no, it's how we call them: long error explanations. No sarcasm here: I'm really happy about this PR! |
About the long error explanation: generally we appreciate to have an example on how to fix it, but I'm not sure it can be applied here so I approved the PR. :) |
cc also @petrochenkov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation looks good; I just have some wording suggestions.
Looks good to me, thanks for tackling this! I agree with @varkor's stylistic/wording "nits" too, for that matter. Modulo that, LGTM? |
Update: review feedback Update: placate tidy
…elf` (Without this commit, you still get an error (a very similar one, at that), but it complains about use of forward declaration, which is confusing since people do not necessarily think of `Self` as being declared at all.) Update: incorporate review feedback.
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
Update: incorporate review feedback.
7a0593c
to
e443e1b
Compare
@bors r=alexreg |
📌 Commit e443e1b has been approved by |
@bors rollup |
…pe-param-default, r=alexreg Disallow Self in type param defaults of ADTs Fix rust-lang#61631 (also includes a drive-by fix to a typo in some related diagnostic output.)
…pe-param-default, r=alexreg Disallow Self in type param defaults of ADTs Fix rust-lang#61631 (also includes a drive-by fix to a typo in some related diagnostic output.)
…pe-param-default, r=alexreg Disallow Self in type param defaults of ADTs Fix rust-lang#61631 (also includes a drive-by fix to a typo in some related diagnostic output.)
Rollup of 11 pull requests Successful merges: - #61879 (Stabilize todo macro) - #64675 (Deprecate `#![plugin]` & `#[plugin_registrar]`) - #64690 (proc_macro API: Expose `macro_rules` hygiene) - #64706 (add regression test for #60218) - #64741 (Prevent rustdoc feature doctests) - #64842 (Disallow Self in type param defaults of ADTs) - #65004 (Replace mentions of IRC with Discord) - #65018 (Set RUST_BACKTRACE=0 in tests that include a backtrace in stderr) - #65055 (Add long error explanation for E0556) - #65056 (Make visit projection iterative) - #65057 (typo: fix typo in E0392) Failed merges: r? @ghost
// rust-lang/rust#61631: The type `Self` is essentially | ||
// another type parameter. For ADTs, we consider it | ||
// well-defined only after all of the ADT type parameters have | ||
// been provided. Therefore, we do not allow use of `Self` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the phrasing (although the conclusion is similar) - see #61631 (comment)
In short, Self
expands to/aliases Adt<A, B, C, ...>
, referring to all the ADTs' parameters, and we shouldn't allow writing Self
where we wouldn't allow Adt<A, B, C, ...>
.
Fix #61631
(also includes a drive-by fix to a typo in some related diagnostic output.)