1 error[E0308]: mismatched types
2 --> $DIR/fn-trait-formatting.rs:6:17
4 LL | let _: () = (box |_: 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 |_: 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 || -> 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
37 LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
38 | ------------------ required by this bound in `needs_fn`
41 | ^ expected an `Fn<(isize,)>` closure, found `{integer}`
43 = help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
45 error: aborting due to 4 previous errors
47 Some errors have detailed explanations: E0277, E0308.
48 For more information about an error, try `rustc --explain E0277`.