-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Tracking issue to remove TyKind::CoroutineWitness from the type system #143017
Copy link
Copy link
Open
Labels
A-coroutinesArea: CoroutinesArea: CoroutinesC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: 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.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-coroutinesArea: CoroutinesArea: CoroutinesC-cleanupCategory: PRs that clean code up or issues documenting cleanup.Category: PRs that clean code up or issues documenting cleanup.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: 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.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm interested in removing the
TyKind::CoroutineWitnessvariant 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.)
Since #101692, the tuple was replaced with a
TyKind::CoroutineWitnesswhich 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 aCoroutineWitnessat 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::CoroutineWitnessaltogether, since it's redundant withTyKind::Coroutinewhich 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:
TypingMode: Properly stall coroutine witnesses in new solver #138845CoroutineWitnesssooner in typeck, and stall coroutine obligations based off ofTypingEnv#141762TyKind::CoroutineWitness