1 error[E0308]: mismatched types
2 --> $DIR/fn-trait-formatting.rs:6:17
4 LL | let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
5 | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
9 = note: expected unit type `()`
10 found struct `Box<dyn FnOnce(isize)>`
12 error[E0308]: mismatched types
13 --> $DIR/fn-trait-formatting.rs:10:17
15 LL | let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
16 | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
18 | expected due to this
20 = note: expected unit type `()`
21 found struct `Box<dyn Fn(isize, isize)>`
23 error[E0308]: mismatched types
24 --> $DIR/fn-trait-formatting.rs:14:17
26 LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
27 | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
29 | expected due to this
31 = note: expected unit type `()`
32 found struct `Box<dyn FnMut() -> isize>`
34 error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
35 --> $DIR/fn-trait-formatting.rs:19:14
38 | -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
40 | required by a bound introduced by this call
42 = help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
43 note: required by a bound in `needs_fn`
44 --> $DIR/fn-trait-formatting.rs:1:31
46 LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
47 | ^^^^^^^^^^^^^^^^^^ required by this bound in `needs_fn`
49 error: aborting due to 4 previous errors
51 Some errors have detailed explanations: E0277, E0308.
52 For more information about an error, try `rustc --explain E0277`.