about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2019-09-08 21:22:51 +0100
committerDavid Wood <david@davidtw.co>2019-09-10 11:27:57 +0100
commit63fad69a9967a56e33927aa31c50768bc1498588 (patch)
tree0512384eac07853d0f132ba768ab25a0f896e594 /src/libstd/sys/unix/stack_overflow.rs
parent43a5ff4222e1f217ac14331afd59f82ec4204d12 (diff)
downloadrust-63fad69a9967a56e33927aa31c50768bc1498588.tar.gz
rust-63fad69a9967a56e33927aa31c50768bc1498588.zip
lowering: extend temporary lifetimes around await
This commit changes the HIR lowering around `await` so that temporary
lifetimes are extended. Previously, await was lowered as:

```rust
{
    let mut pinned = future;
    loop {
        match ::std::future::poll_with_tls_context(unsafe {
            <::std::pin::Pin>::new_unchecked(&mut pinned)
        }) {
            ::std::task::Poll::Ready(result) => break result,
            ::std::task::Poll::Pending => {}
        }
        yield ();
    }
}
```

With this commit, await is lowered as:

```rust
match future {
    mut pinned => loop {
        match ::std::future::poll_with_tls_context(unsafe {
            <::std::pin::Pin>::new_unchecked(&mut pinned)
        }) {
            ::std::task::Poll::Ready(result) => break result,
            ::std::task::Poll::Pending => {}
        }
        yield ();
    }
}
```

However, this change has the following side-effects:

- All temporaries in future will be considered to live across a
  yield for the purpose of auto-traits.
- Borrowed temporaries in future are likely to be considered to be live
  across the yield for the purpose of the generator transform.

Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions