fork/rust

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

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.9 KiB48 linesraw
1error[E0308]: mismatched types
2  --> $DIR/fn-trait-formatting.rs:6:17
3   |
4LL |     let _: () = (box |_: isize| {}) as Box<dyn FnOnce(isize)>;
5   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `std::boxed::Box`
6   |            |
7   |            expected due to this
8   |
9   = note: expected unit type `()`
10                 found struct `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
11
12error[E0308]: mismatched types
13  --> $DIR/fn-trait-formatting.rs:10:17
14   |
15LL |     let _: () = (box |_: isize, isize| {}) as Box<dyn Fn(isize, isize)>;
16   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `std::boxed::Box`
17   |            |
18   |            expected due to this
19   |
20   = note: expected unit type `()`
21                 found struct `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
22
23error[E0308]: mismatched types
24  --> $DIR/fn-trait-formatting.rs:14:17
25   |
26LL |     let _: () = (box || -> isize { unimplemented!() }) as Box<dyn FnMut() -> isize>;
27   |            --   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found struct `std::boxed::Box`
28   |            |
29   |            expected due to this
30   |
31   = note: expected unit type `()`
32                 found struct `std::boxed::Box<dyn std::ops::FnMut() -> isize>`
33
34error[E0277]: expected a `std::ops::Fn<(isize,)>` closure, found `{integer}`
35  --> $DIR/fn-trait-formatting.rs:19:14
36   |
37LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
38   |    --------                   ------------------ required by this bound in `needs_fn`
39...
40LL |     needs_fn(1);
41   |              ^ expected an `Fn<(isize,)>` closure, found `{integer}`
42   |
43   = help: the trait `std::ops::Fn<(isize,)>` is not implemented for `{integer}`
44
45error: aborting due to 4 previous errors
46
47Some errors have detailed explanations: E0277, E0308.
48For more information about an error, try `rustc --explain E0277`.