fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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