The following code
|
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.
The following code
rust/src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs
Lines 10 to 20 in 38e5764
emits
rust/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr
Lines 1 to 9 in 38e5764
It should point at the
where T : Eqbound as well.Noticed in https://github.com/rust-lang/rust/pull/88719/files#r708156543: