rust/library/core/src/future
Arpad Borsos 96931a787a
Transform async ResumeTy in generator transform
- Eliminates all the `get_context` calls that async lowering created.
- Replace all `Local` `ResumeTy` types with `&mut Context<'_>`.

The `Local`s that have their types replaced are:
- The `resume` argument itself.
- The argument to `get_context`.
- The yielded value of a `yield`.

The `ResumeTy` hides a `&mut Context<'_>` behind an unsafe raw pointer, and the
`get_context` function is being used to convert that back to a `&mut Context<'_>`.

Ideally the async lowering would not use the `ResumeTy`/`get_context` indirection,
but rather directly use `&mut Context<'_>`, however that would currently
lead to higher-kinded lifetime errors.
See <https://github.com/rust-lang/rust/issues/105501>.

The async lowering step and the type / lifetime inference / checking are
still using the `ResumeTy` indirection for the time being, and that indirection
is removed here. After this transform, the generator body only knows about `&mut Context<'_>`.
2023-01-19 09:03:05 +01:00
..
future.rs Suggest more impl Trait on -> _ 2023-01-03 23:50:31 +00:00
into_future.rs
join.rs
mod.rs Transform async ResumeTy in generator transform 2023-01-19 09:03:05 +01:00
pending.rs
poll_fn.rs poll_fn and Unpin: fix pinning 2022-10-06 13:51:10 +02:00
ready.rs