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