-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Error message’s hint pointing entirely at the wrong place. #77677
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Reduced example:
(Playground)
Errors:
This came up during refactoring, while I was adding the parameter
TtoBar(intentionally named the same as the outerTbecause they are going to be instantiated to the same type anyways). This kind of error message (the first one,E0401) had me puzzled for some time before figuring out that it was nonsensical. I’m referring to thetry adding a local generic parameter in this method insteadpart. The real code of course was quite a bit longer, making the situation actually confusing, in particular:try adding ...hint points to the wrong place entirely. It should suggest adding a parameter to theimpl TraitG(even though such a suggestion might not always make sense, idk).type parameter from outer functionpointer is also somewhat confusing, since whenfoo’s body is a few lines andbaris super long and nested, it is quite nontrivial to even figure out that “outer function” refers tobar(). (As in: it is easy to forget that you’re even inside of a function body at all if you’ve been focusing on thisBarstruct and it’simpls for a while.) Also... what is the distinction between the wordsfunctionandmethodhere? (My original code hasbar(self)but still called it “outer function”.)@rustbot modify labels: A-diagnostics, T-compiler, D-confusing, C-bug.