blob: 5b63b8e2285c9649120b9cc92f4027487d2c1b5e [file] [log] [blame]
error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:6:17
|
LL | let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
| |
| expected due to this
|
= note: expected unit type `()`
found struct `Box<dyn FnOnce(isize)>`
error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:10:17
|
LL | let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
| |
| expected due to this
|
= note: expected unit type `()`
found struct `Box<dyn Fn(isize, isize)>`
error[E0308]: mismatched types
--> $DIR/fn-trait-formatting.rs:14:17
|
LL | let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
| |
| expected due to this
|
= note: expected unit type `()`
found struct `Box<dyn FnMut() -> isize>`
error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
--> $DIR/fn-trait-formatting.rs:19:14
|
LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
| ------------------ required by this bound in `needs_fn`
...
LL | needs_fn(1);
| ^ expected an `Fn<(isize,)>` closure, found `{integer}`
|
= help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.