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