Skip to content

Commit

Permalink
Update await desugaring after rust-lang/rust#64292
Browse files Browse the repository at this point in the history
Signed-off-by: David Wood <david@davidtw.co>
  • Loading branch information
davidtwco committed Sep 8, 2019
1 parent dce794c commit 1b44947
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/expressions/await-expr.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ Effectively, an `<expr>.await` expression is roughly
equivalent to the following (this desugaring is not normative):

```rust,ignore
let future = /* <expr> */;
loop {
let mut pin = unsafe { Pin::new_unchecked(&mut future) };
match Pin::future::poll(Pin::borrow(&mut pin), &mut current_context) {
Poll::Ready(r) => break r,
Poll::Pending => yield Poll::Pending,
match /* <expr> */ {
mut pinned => loop {
let mut pin = unsafe { Pin::new_unchecked(&mut pinned) };
match Pin::future::poll(Pin::borrow(&mut pin), &mut current_context) {
Poll::Ready(r) => break r,
Poll::Pending => yield Poll::Pending,
}
}
}
```
Expand Down

0 comments on commit 1b44947

Please sign in to comment.