Rollup merge of #69033 - jonas-schievink:resume-with-context, r=tmandry

Use generator resume arguments in the async/await lowering

This removes the TLS requirement from async/await and enables it in `#![no_std]` crates.

Closes https://github.com/rust-lang/rust/issues/56974

I'm not confident the HIR lowering is completely correct, there seem to be quite a few undocumented invariants in there. The `async-std` and tokio test suites are passing with these changes though.
This commit is contained in:
Mazdak Farrokhzad 2020-03-21 05:33:15 +01:00 committed by GitHub
commit ef7c8a158f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 205 additions and 37 deletions

View file

@ -33,10 +33,10 @@ error[E0277]: the trait bound `[closure@$DIR/issue-62009-1.rs:16:5: 16:15]: std:
LL | (|_| 2333).await;
| ^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:16:5: 16:15]`
|
::: $SRC_DIR/libstd/future.rs:LL:COL
::: $SRC_DIR/libcore/future/mod.rs:LL:COL
|
LL | F: Future,
| ------ required by this bound in `std::future::poll_with_tls_context`
| ------ required by this bound in `std::future::poll_with_context`
error: aborting due to 4 previous errors

View file

@ -0,0 +1,13 @@
// edition:2018
// check-pass
#![no_std]
#![crate_type = "rlib"]
use core::future::Future;
async fn a(f: impl Future) {
f.await;
}
fn main() {}