Typo in trait function results in misleading error message and subpar suggestion #135349
Labels
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.
Code
Current output
Desired output
Rationale and extra context
I have three complaints with the current error message:
expected a type, found a trait
, but a trait as the second last component in a path is valid... everywhere. This error message seems wrong? It certainly confused me for a second.<dyn Default>::defualt()
would give me a trait object... exceptDefault
can't be made into a trait object precisely because it has a method that takes no parameters. I could be wrong, but I suspect<dyn Ident1>::ident2()
is never valid.All can be fixed at once with the proposed output, which treats the trait
Default
like a module namedDefault
containing a functiondefault
. If that's not desired because it would make other error messages worse, I hope the specific complaints can at least be improved on.Other cases
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: