1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
// edition:2018 trait T { type O; } struct S; impl T for S { type O = (); } fn foo() -> impl T<O=()> { S } fn bar(f: impl T<O=()>) {} fn main() { bar(foo); //~ERROR E0277 let closure = || S; bar(closure); //~ERROR E0277 }