-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
The compiler should be more helpful when trait bounds are not met. #64417
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-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 lintsA-trait-systemArea: Trait systemArea: Trait systemD-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.
Here's a reduced testcase:
This fails to compile with:
The way
#[derive]works (#26925), and with 20/20 hindsight, it's obvious what's wrong. But even when you know about #26925 it takes a mental effort to go from that error message to "oh, right,#[derive(Clone)]addsT: Clone".It would be useful if the compiler went further, and, considering there is an
impl Clone for Bar<T>, detailed why that impl doesn't apply toFoo.