fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
3.4 KiB87 linesraw
1error[E0267]: `break` inside of an `async` block
2  --> $DIR/async-block-control-flow-static-semantics.rs:33:9
3   |
4LL |       async {
5   |  ___________-
6LL | |         break 0u8;
7   | |         ^^^^^^^^^ cannot `break` inside of an `async` block
8LL | |     };
9   | |_____- enclosing `async` block
10
11error[E0267]: `break` inside of an `async` block
12  --> $DIR/async-block-control-flow-static-semantics.rs:40:13
13   |
14LL |           async {
15   |  _______________-
16LL | |             break 0u8;
17   | |             ^^^^^^^^^ cannot `break` inside of an `async` block
18LL | |         };
19   | |_________- enclosing `async` block
20
21error[E0308]: mismatched types
22  --> $DIR/async-block-control-flow-static-semantics.rs:13:43
23   |
24LL | fn return_targets_async_block_not_fn() -> u8 {
25   |    ---------------------------------      ^^ expected u8, found ()
26   |    |
27   |    implicitly returns `()` as its body has no tail or `return` expression
28   |
29   = note: expected type `u8`
30              found type `()`
31
32error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
33  --> $DIR/async-block-control-flow-static-semantics.rs:18:39
34   |
35LL |     let _: &dyn Future<Output = ()> = &block;
36   |                                       ^^^^^^ expected u8, found ()
37   |
38   = note: expected type `u8`
39              found type `()`
40   = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
41
42error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
43  --> $DIR/async-block-control-flow-static-semantics.rs:27:39
44   |
45LL |     let _: &dyn Future<Output = ()> = &block;
46   |                                       ^^^^^^ expected u8, found ()
47   |
48   = note: expected type `u8`
49              found type `()`
50   = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
51
52error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == u8`
53  --> $DIR/async-block-control-flow-static-semantics.rs:22:55
54   |
55LL | async fn return_targets_async_block_not_async_fn() -> u8 {
56   |                                                       ^^ expected (), found u8
57   |
58   = note: expected type `()`
59              found type `u8`
60   = note: the return type of a function must have a statically known size
61
62error[E0308]: mismatched types
63  --> $DIR/async-block-control-flow-static-semantics.rs:48:44
64   |
65LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
66   |    ----------------------------------      ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
67   |    |
68   |    implicitly returns `()` as its body has no tail or `return` expression
69   |
70   = note: expected type `std::result::Result<u8, MyErr>`
71              found type `()`
72
73error[E0308]: mismatched types
74  --> $DIR/async-block-control-flow-static-semantics.rs:57:50
75   |
76LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
77   |    ----------------------------------------      ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
78   |    |
79   |    implicitly returns `()` as its body has no tail or `return` expression
80   |
81   = note: expected type `std::result::Result<u8, MyErr>`
82              found type `()`
83
84error: aborting due to 8 previous errors
85
86Some errors have detailed explanations: E0267, E0271, E0308.
87For more information about an error, try `rustc --explain E0267`.