Skip to content

Remove need for ResumeTy / get_context in async generators #104828

Closed
@Swatinem

Description

@Swatinem

#104321 changed async blocks/functions to not go through from_generator / GenFuture, but made those generators implement Future directly.

Though inside those special generators, it is still necessary to hide the &Context<'_> poll argument behind an unsafe ResumeTy 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 the Future::poll call into an internal Generator::resume(ResumeTy).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions