fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

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