-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove need for ResumeTy
/ get_context
in async generators
#104828
Comments
This was referenced Nov 30, 2022
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Dec 5, 2022
Replace usage of `ResumeTy` in async lowering with `Context` Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air. fixes rust-lang#104828 and rust-lang#104321 (comment) r? `@oli-obk`
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Dec 5, 2022
Replace usage of `ResumeTy` in async lowering with `Context` Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air. fixes rust-lang#104828 and rust-lang#104321 (comment) r? ``@oli-obk``
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Dec 5, 2022
Replace usage of `ResumeTy` in async lowering with `Context` Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air. fixes rust-lang#104828 and rust-lang#104321 (comment) r? ```@oli-obk```
thomcc
pushed a commit
to tcdi/postgrestd
that referenced
this issue
Feb 10, 2023
Replace usage of `ResumeTy` in async lowering with `Context` Replaces using `ResumeTy` / `get_context` in favor of using `&'static mut Context<'_>`. Usage of the `'static` lifetime here is technically "cheating", and replaces the raw pointer in `ResumeTy` and the `get_context` fn that pulls the correct lifetimes out of thin air. fixes rust-lang/rust#104828 and rust-lang/rust#104321 (comment) r? `@oli-obk`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#104321 changed async blocks/functions to not go through
from_generator
/GenFuture
, but made those generators implementFuture
directly.Though inside those special generators, it is still necessary to hide the
&Context<'_>
poll argument behind an unsafeResumeTy
wrapper which removes any lifetime constraints.It should be possible to remove that type, and the unsafe
get_context
function which turns it back into a&Context<'_>
to poll child futures.With #104321 the compiler already "cheats" and magically turns the
&Context<'_>
of theFuture::poll
call into an internalGenerator::resume(ResumeTy)
.The text was updated successfully, but these errors were encountered: