Closed
Description
trait Bar {
type Ok;
type Sibling: Bar2<Ok=Self::Ok>;
}
trait Bar2 {
type Ok;
}
struct Foo;
struct Foo2;
impl Bar for Foo {
type Ok = ();
type Sibling = Foo2;
}
impl Bar2 for Foo2 {
type Ok = u32; // <- `u32` instead of `()`
}
Errors:
error[E0271]: type mismatch resolving `<Foo2 as Bar2>::Ok == ()`
--> src/lib.rs:14:6
|
14 | impl Bar for Foo {
| ^^^ expected u32, found ()
|
= note: expected type `u32`
found type `()`
I don't like the error message, I would like to see something similar to this
error[E0271]: type mismatch resolving `<Foo2 as Bar2>::Ok == ()`
...
LN | type Ok = ();
| ^^^^^^^^^^^^ associated type Ok defined here
LN | type Sibling: Bar2<Ok=Self::Ok>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type constrained here
| ...
LN | type Ok = u32; // <- `u32` instead of `()`
| ^^^^^^^^^^^^^ type violated here