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:
commit
ef7c8a158f
9 changed files with 205 additions and 37 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
13
src/test/ui/async-await/no-std.rs
Normal file
13
src/test/ui/async-await/no-std.rs
Normal 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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue