File tree 1 file changed +2
-2
lines changed
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ Async contexts are established by async blocks as well as the bodies of async fu
103
103
104
104
Async blocks act like a function boundary, much like closures.
105
105
Therefore, the `?` operator and `return` expressions both affect the output of the future, not the enclosing function or other context.
106
- That is, `return <expr>` from within a closure will return the result of `<expr>` as the output of the future.
106
+ That is, `return <expr>` from within an async block will return the result of `<expr>` as the output of the future.
107
107
Similarly, if `<expr>?` propagates an error, that error is propagated as the result of the future.
108
108
109
109
Finally, the `break` and `continue` keywords cannot be used to branch out from an async block.
@@ -112,7 +112,7 @@ Therefore the following is illegal:
112
112
```rust,compile_fail
113
113
loop {
114
114
async move {
115
- break; // This would break out of the loop.
115
+ break; // error[E0267]: ` break` inside of an `async` block
116
116
}
117
117
}
118
118
```
You can’t perform that action at this time.
0 commit comments