-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.
Description
The following code
rust/src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs
Lines 10 to 20 in 38e5764
impl<T> Foo<T> { | |
fn equals(&self, u: &Foo<T>) -> bool where T : Eq { | |
self.value == u.value | |
} | |
} | |
fn main() { | |
let x = Foo { value: Bar }; | |
x.equals(&x); | |
//~^ ERROR `Bar: Eq` is not satisfied | |
} |
emits
error[E0277]: the trait bound `Bar: Eq` is not satisfied | |
--> $DIR/where-clauses-method-unsatisfied.rs:18:14 | |
| | |
LL | x.equals(&x); | |
| ------ ^^ the trait `Eq` is not implemented for `Bar` | |
| | | |
| required by a bound introduced by this call | |
error: aborting due to previous error |
It should point at the where T : Eq
bound as well.
Noticed in https://github.com/rust-lang/rust/pull/88719/files#r708156543:
This case has a
MiscObligation
, so for some where clauses we need to do better, but at least we point at the relevant argument. The new span pointing at the call at least hints at the user that they should look at the equals implementation to figure out why the bound was added.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemD-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.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.