1 trait Foo { 2 type Item; 3 } 4 5 trait Bar: Foo {} 6 7 struct S; 8 9 impl Foo for S { 10 type Item = i32; 11 } 12 impl Bar for S {} 13 14 struct T; 15 16 impl Foo for T { 17 type Item = u32; 18 } 19 impl Bar for T {} 20 bar() -> impl Bar21fn bar() -> impl Bar { 22 T 23 } 24 baz() -> impl Bar<Item = i32>25fn baz() -> impl Bar<Item = i32> { 26 //~^ ERROR type mismatch resolving `<impl Bar as Foo>::Item == i32` 27 bar() 28 } 29 main()30fn main() { 31 let _ = baz(); 32 } 33