Improve error message for impl Self
#65784
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Suppose you have the following reduced code example:
This gives you the error message:
This is confusing because there isn't actually any obvious cycle (unless you know things about compilers). E0391 actually describes itself with an example like this:
This looks nothing like the original code example.
We should probably detect this case and provide a more useful message that indicates that
Self
is a special keyword that can be used within the impl block, but not as the type of the impl block itself.The text was updated successfully, but these errors were encountered: