fn needs_fn(x: F) where F: Fn(isize) -> isize {} fn main() { let _: () = Box::new(|_: isize| {}) as Box; //~^ ERROR mismatched types //~| expected unit type `()` //~| found struct `Box` let _: () = Box::new(|_: isize, isize| {}) as Box; //~^ ERROR mismatched types //~| expected unit type `()` //~| found struct `Box` let _: () = Box::new(|| -> isize { unimplemented!() }) as Box isize>; //~^ ERROR mismatched types //~| expected unit type `()` //~| found struct `Box isize>` needs_fn(1); //~^ ERROR expected a `Fn(isize)` closure, found `{integer}` }