#![feature(impl_trait_in_assoc_type)] trait Foo: Sized { type Bar; type Gat; fn foo(self) -> (::Gat, ::Gat); } impl Foo for u32 { type Bar = (); type Gat = (); fn foo(self) -> (::Gat, ::Gat) { ((), ()) } } impl Foo for () { type Bar = impl Sized; //~^ ERROR: unconstrained opaque type type Gat = ::Bar; // Because we encounter `Gat` first, we never walk into another `Gat` // again, thus missing the opaque type that we could be defining. fn foo(self) -> (::Gat, ::Gat) { ((), ()) //~^ ERROR: mismatched types } } fn main() {}