Closed
Description
When encountering code that requires a deriveable trait on a type that doesn't have it, we currently emit an E0277 error and when possible point at the trait bound that introduced the obligation:
error[E0277]: can't compare `S` with `S`
--> src/main.rs:3:9
|
3 | foo(S);
| --- ^ no implementation for `S == S`
| |
| required by a bound introduced by this call
|
= help: the trait `PartialEq` is not implemented for `S`
note: required by a bound in `foo`
--> src/main.rs:6:11
|
6 | fn foo<T: PartialEq>(_: T) {}
| ^^^^^^^^^ required by this bound in `foo`
When the bound applies on a local type, we should suggest
help: consider annotating `S` with `#[derive(PartialEq)]`
|
1 | #[derive(PartialEq)]
|
like we do for E0369.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.