1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
//@ known-bug: #139120 pub trait Foo { type Bar<'a>; } pub struct FooImpl {} impl Foo for FooImpl { type Bar<'a> = (); } pub trait FooFn { fn bar(&self); } impl<T: Foo> FooFn for fn(T, T::Bar<'_>) { fn bar(&self) {} } fn foo<T: Foo>(f: fn(T, T::Bar<'_>)) { let _: &dyn FooFn = &f; } fn main() { foo(|_: FooImpl, _| {}); }