]> git.lizzy.rs Git - rust.git/blob - src/test/ui/fn/fn-trait-formatting.stderr
Auto merge of #100966 - compiler-errors:revert-remove-deferred-sized-checks, r=pnkfelix
[rust.git] / src / test / ui / fn / fn-trait-formatting.stderr
1 error[E0308]: mismatched types
2   --> $DIR/fn-trait-formatting.rs:6:17
3    |
4 LL |     let _: () = Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>;
5    |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
6    |            |
7    |            expected due to this
8    |
9    = note: expected unit type `()`
10                  found struct `Box<dyn FnOnce(isize)>`
11 help: use parentheses to call this trait object
12    |
13 LL |     let _: () = (Box::new(|_: isize| {}) as Box<dyn FnOnce(isize)>)(/* isize */);
14    |                 +                                                 ++++++++++++++
15
16 error[E0308]: mismatched types
17   --> $DIR/fn-trait-formatting.rs:10:17
18    |
19 LL |     let _: () = Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
20    |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
21    |            |
22    |            expected due to this
23    |
24    = note: expected unit type `()`
25                  found struct `Box<dyn Fn(isize, isize)>`
26 help: use parentheses to call this trait object
27    |
28 LL |     let _: () = (Box::new(|_: isize, isize| {}) as Box<dyn Fn(isize, isize)>)(/* isize */, /* isize */);
29    |                 +                                                           +++++++++++++++++++++++++++
30
31 error[E0308]: mismatched types
32   --> $DIR/fn-trait-formatting.rs:14:17
33    |
34 LL |     let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
35    |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `Box`
36    |            |
37    |            expected due to this
38    |
39    = note: expected unit type `()`
40                  found struct `Box<dyn FnMut() -> isize>`
41
42 error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
43   --> $DIR/fn-trait-formatting.rs:19:14
44    |
45 LL |     needs_fn(1);
46    |     -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
47    |     |
48    |     required by a bound introduced by this call
49    |
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
53    |
54 LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
55    |                               ^^^^^^^^^^^^^^^^^^ required by this bound in `needs_fn`
56
57 error: aborting due to 4 previous errors
58
59 Some errors have detailed explanations: E0277, E0308.
60 For more information about an error, try `rustc --explain E0277`.