Open
Description
Today, valid programs using coroutines (and async/await) are rejected by the compiler because it thinks certain values may be held across yields when they are not.
Examples / to do: (please add more as they come up)
- async/await: awaiting inside a match block captures borrow too eagerly #57017
- Dropped variables still included in generator type #57478
- Indexing via
index
method and[idx]
sugar works differently inasync
blocks/functions #72956 - ICE: Broken MIR #72651
- The rules for how non-Send local variables "infect" an async function, making its Future type non-Send also, are stricter than they need to be. #63768
- Moved value is considered as held across an
await
inasync fn
#87309 - Future non-Send although non-Send local is dropped before .await #104883
Unresolved Questions
How should we implement this?
Are there any programs which could be accepted, but shouldn't be because they would depend too heavily on implementation details of the compiler?
Implementation notes
There's some discussion here: #57017 (comment)
This issue has been assigned to @eholk via this comment.
Metadata
Metadata
Assignees
Labels
Area: Async & AwaitArea: CoroutinesArea: Type systemAsync-await issues that have been triaged during a working group meeting.Category: An issue proposing an enhancement or a PR with one.Call for participation: Hard difficulty. Experience needed to fix: A lot.Relevant to the compiler 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
Projects
Status
On deck