2018-08-08 12:28:26 +00:00
|
|
|
error[E0308]: mismatched types
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/fn-trait-formatting.rs:6:17
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2021-08-25 00:39:40 +00:00
|
|
|
LL | let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
|
2023-01-03 02:00:33 +00:00
|
|
|
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn FnOnce(isize)>`
|
2019-11-19 05:00:24 +00:00
|
|
|
| |
|
|
|
|
| expected due to this
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-11-14 22:08:08 +00:00
|
|
|
= note: expected unit type `()`
|
2020-09-02 07:40:56 +00:00
|
|
|
found struct `Box<dyn FnOnce(isize)>`
|
2022-08-27 23:08:21 +00:00
|
|
|
help: use parentheses to call this trait object
|
|
|
|
|
|
2022-08-28 01:22:51 +00:00
|
|
|
LL | let _: () = (Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>)(/* isize */);
|
|
|
|
| + ++++++++++++++
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/fn-trait-formatting.rs:10:17
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2021-08-25 00:39:40 +00:00
|
|
|
LL | let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
|
2023-01-03 02:00:33 +00:00
|
|
|
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn Fn(isize, isize)>`
|
2019-11-19 05:00:24 +00:00
|
|
|
| |
|
|
|
|
| expected due to this
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-11-14 22:08:08 +00:00
|
|
|
= note: expected unit type `()`
|
2020-09-02 07:40:56 +00:00
|
|
|
found struct `Box<dyn Fn(isize, isize)>`
|
2022-08-27 23:08:21 +00:00
|
|
|
help: use parentheses to call this trait object
|
|
|
|
|
|
2022-08-28 01:22:51 +00:00
|
|
|
LL | let _: () = (Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>)(/* isize */, /* isize */);
|
|
|
|
| + +++++++++++++++++++++++++++
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
2018-12-25 15:56:47 +00:00
|
|
|
--> $DIR/fn-trait-formatting.rs:14:17
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2021-08-25 00:39:40 +00:00
|
|
|
LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
|
2023-01-03 02:00:33 +00:00
|
|
|
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn FnMut() -> isize>`
|
2019-11-19 05:00:24 +00:00
|
|
|
| |
|
|
|
|
| expected due to this
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2019-11-14 22:08:08 +00:00
|
|
|
= note: expected unit type `()`
|
2020-09-02 07:40:56 +00:00
|
|
|
found struct `Box<dyn FnMut() -> isize>`
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
|
2019-09-16 04:58:20 +00:00
|
|
|
--> $DIR/fn-trait-formatting.rs:19:14
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
|
LL | needs_fn(1);
|
2021-09-07 11:30:53 +00:00
|
|
|
| -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
|
|
|
|
| |
|
|
|
|
| required by a bound introduced by this call
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2020-09-02 07:40:56 +00:00
|
|
|
= help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
|
2021-07-31 16:26:55 +00:00
|
|
|
note: required by a bound in `needs_fn`
|
2021-08-25 00:39:40 +00:00
|
|
|
--> $DIR/fn-trait-formatting.rs:1:31
|
2021-07-31 16:26:55 +00:00
|
|
|
|
|
|
|
|
LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
|
|
|
|
| ^^^^^^^^^^^^^^^^^^ required by this bound in `needs_fn`
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|
2019-04-17 17:26:38 +00:00
|
|
|
Some errors have detailed explanations: E0277, E0308.
|
2018-08-08 12:28:26 +00:00
|
|
|
For more information about an error, try `rustc --explain E0277`.
|