fork/rust

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

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

1.40.0
3.3 KiB93 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 (), found u8
37   |
38   = note: expected type `()`
39              found type `u8`
40   = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
41
42error[E0308]: mismatched types
43  --> $DIR/async-block-control-flow-static-semantics.rs:22:58
44   |
45LL |   async fn return_targets_async_block_not_async_fn() -> u8 {
46   |  __________________________________________________________^
47LL | |
48LL | |     let block = async {
49LL | |         return 0u8;
50...  |
51LL | |
52LL | | }
53   | |_^ expected u8, found ()
54   |
55   = note: expected type `u8`
56              found type `()`
57
58error[E0271]: type mismatch resolving `<impl std::future::Future as std::future::Future>::Output == ()`
59  --> $DIR/async-block-control-flow-static-semantics.rs:27:39
60   |
61LL |     let _: &dyn Future<Output = ()> = &block;
62   |                                       ^^^^^^ expected (), found u8
63   |
64   = note: expected type `()`
65              found type `u8`
66   = note: required for the cast to the object type `dyn std::future::Future<Output = ()>`
67
68error[E0308]: mismatched types
69  --> $DIR/async-block-control-flow-static-semantics.rs:48:44
70   |
71LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
72   |    ----------------------------------      ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
73   |    |
74   |    implicitly returns `()` as its body has no tail or `return` expression
75   |
76   = note: expected type `std::result::Result<u8, MyErr>`
77              found type `()`
78
79error[E0308]: mismatched types
80  --> $DIR/async-block-control-flow-static-semantics.rs:57:50
81   |
82LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
83   |    ----------------------------------------      ^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found ()
84   |    |
85   |    implicitly returns `()` as its body has no tail or `return` expression
86   |
87   = note: expected type `std::result::Result<u8, MyErr>`
88              found type `()`
89
90error: aborting due to 8 previous errors
91
92Some errors have detailed explanations: E0267, E0271, E0308.
93For more information about an error, try `rustc --explain E0267`.