//@ check-pass fn any() -> T { loop {} } trait Foo { type V; } trait Callback: Fn(&T, &T::V) {} impl Callback for F {} struct Bar { callback: Box>, } impl Bar { fn event(&self) { (self.callback)(any(), any()); } } struct A; struct B; impl Foo for A { type V = B; } fn main() { let foo = Bar:: { callback: Box::new(|_: &A, _: &B| ()) }; foo.event(); }