Skip to content

Tracking issue to remove TyKind::CoroutineWitness from the type system #143017

Open
@compiler-errors

Description

@compiler-errors

I'm interested in removing the TyKind::CoroutineWitness variant from the type system.

Coroutine witnesses are a synthetic generic arg given to coroutines to stall the computation of the "witness" types of the coroutine (which are the variables live across await points) by initially being populated with an infer var, then getting inferred to a tuple after analysis was run at the end of typeck. (We do similar things for closures, for example, for their upvars.)

However, since #101692, the tuple was replaced with a TyKind::CoroutineWitness which defers that computation further to MIR. However, we still use an infer var to stall obligations that would rely on using these witness types (and only unify with with a CoroutineWitness at the end of typeck), since if we try to query for the witnesses during typeck in the same body that defines the coroutine, we would encounter query cycles.

#138845 introduced a more appropriate way to stall oblgiations that rely on coroutine witnesses which is currently used in the new solver. I'd like to use this in the old solver, and eventually rip out the TyKind::CoroutineWitness altogether, since it's redundant with TyKind::Coroutine which stores the same def-id and args as the former.

This is a tracking issue to make sure that I follow up with the work.

Rough timeline:

Metadata

Metadata

Labels

A-coroutinesArea: CoroutinesC-cleanupCategory: PRs that clean code up or issues documenting cleanup.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-typesRelevant to the types team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions