Confusing error message when passing trait object to generic function #57744
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
A-trait-system
Area: Trait system
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This could be the same issue as #23286 but I'm not sure.
The following code gives this error (playground):
There's a couple reasons this is very confusing:
points to the function name not the parameter
w
.dyn Write
only appears behind a reference which means it should be sized.We should show a better error message when you pass a
&dyn T
value to a function expecting a generic&T
value.cc @munik
The text was updated successfully, but these errors were encountered: