rust/tests/ui/fn/fn-trait-formatting.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
2.5 KiB
Plaintext
Raw Normal View History

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
|
LL | let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn FnOnce(isize)>`
| |
| expected due to this
2018-08-08 12:28:26 +00:00
|
2019-11-14 22:08:08 +00:00
= note: expected unit type `()`
found struct `Box<dyn FnOnce(isize)>`
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
|
LL | let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn Fn(isize, isize)>`
| |
| expected due to this
2018-08-08 12:28:26 +00:00
|
2019-11-14 22:08:08 +00:00
= note: expected unit type `()`
found struct `Box<dyn Fn(isize, isize)>`
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
|
LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
| -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `Box<dyn FnMut() -> isize>`
| |
| expected due to this
2018-08-08 12:28:26 +00:00
|
2019-11-14 22:08:08 +00:00
= note: expected unit type `()`
found struct `Box<dyn FnMut() -> isize>`
2018-08-08 12:28:26 +00:00
error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
--> $DIR/fn-trait-formatting.rs:19:14
2018-08-08 12:28:26 +00:00
|
LL | needs_fn(1);
| -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
| |
| required by a bound introduced by this call
2018-08-08 12:28:26 +00:00
|
= help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
note: required by a bound in `needs_fn`
--> $DIR/fn-trait-formatting.rs:1:31
|
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
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`.