trait Foo { fn foo() {} }
trait Bar {}
impl<T: Bar> Foo for T {}
fn main() {
<i32 as Foo>::foo();
}
Reported error tries to be too smart:
error[E0277]: the trait bound `i32: Bar` is not satisfied
|
| <i32 as Foo>::foo();
| ^^^^^^^^^^^^^^^^^ the trait `Bar` is not implemented for `i32`
|
= note: required because of the requirements on the impl of `Foo` for `i32`
= note: required by `Foo::foo`
... but is misleading since the real error is that i32: Foo is not satisfied; i32 may happen to implement Foo and not implement Bar, so the error message is actually just wrong.
Reported error tries to be too smart:
... but is misleading since the real error is that
i32: Foois not satisfied;i32may happen to implementFooand not implementBar, so the error message is actually just wrong.