-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Misleading Error Message: the trait Foo is not implemented for &dyn Foo #73492
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`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 lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`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.
Here is a minimal example [playground]:
Which produces this error:
I find this error to be misleading because:
ywithin the closure should be&&dyn Foo, not&dyn Foo.Fooshould be implemented for&dyn Fooif that were the actual type ofy.This can be fixed in a number of ways:
All of which are consistent with
ybeing of type&&dyn Foo, and none of which are suggested by the error message.