//@ check-pass #![allow(dead_code)] trait Trait1 { fn f1(self) -> U; } trait Trait2 { type T; type U: Trait2; fn f2(f: impl FnOnce(&Self::U)); } fn f3() -> impl Trait1 { Struct1 } struct Struct1; impl Trait1 for Struct1 { fn f1(self) -> T::T { unimplemented!() } } fn f4() { T::f2(|_| { f3::().f1(); }); } fn main() {}