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)>`
11 help: use parentheses to call this trait object
13 LL | let _: () = (Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>)(/* isize */);
16 error[E0308]: mismatched types
17 --> $DIR/fn-trait-formatting.rs:10:17
19 LL | let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
20 | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
22 | expected due to this
24 = note: expected unit type `()`
25 found struct `Box<dyn Fn(isize, isize)>`
26 help: use parentheses to call this trait object
28 LL | let _: () = (Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>)(/* isize */, /* isize */);
29 | + +++++++++++++++++++++++++++
31 error[E0308]: mismatched types
32 --> $DIR/fn-trait-formatting.rs:14:17
34 LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
35 | -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
37 | expected due to this
39 = note: expected unit type `()`
40 found struct `Box<dyn FnMut() -> isize>`
42 error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
43 --> $DIR/fn-trait-formatting.rs:19:14
46 | -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
48 | required by a bound introduced by this call
50 = help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
51 note: required by a bound in `needs_fn`
52 --> $DIR/fn-trait-formatting.rs:1:31
54 LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
55 | ^^^^^^^^^^^^^^^^^^ required by this bound in `needs_fn`
57 error: aborting due to 4 previous errors
59 Some errors have detailed explanations: E0277, E0308.
60 For more information about an error, try `rustc --explain E0277`.