]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/async-block-control-flow-static-semantics.stderr
Rollup merge of #65554 - gliderkite:bufreader-doc-enhance, r=KodrAus
[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:33: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:40: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[E0308]: mismatched types
22   --> $DIR/async-block-control-flow-static-semantics.rs:13:43
23    |
24 LL | 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
32 error[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    |
35 LL |     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
42 error[E0308]: mismatched types
43   --> $DIR/async-block-control-flow-static-semantics.rs:22:58
44    |
45 LL |   async fn return_targets_async_block_not_async_fn() -> u8 {
46    |  __________________________________________________________^
47 LL | |
48 LL | |     let block = async {
49 LL | |         return 0u8;
50 ...  |
51 LL | |
52 LL | | }
53    | |_^ expected u8, found ()
54    |
55    = note: expected type `u8`
56               found type `()`
57
58 error[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    |
61 LL |     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
68 error[E0308]: mismatched types
69   --> $DIR/async-block-control-flow-static-semantics.rs:48:44
70    |
71 LL | 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
79 error[E0308]: mismatched types
80   --> $DIR/async-block-control-flow-static-semantics.rs:57:50
81    |
82 LL | 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
90 error: aborting due to 8 previous errors
91
92 Some errors have detailed explanations: E0267, E0271, E0308.
93 For more information about an error, try `rustc --explain E0267`.