Repository navigation
§14.10 (#2956): a select await arm races any async expression - #3018
Merged
Merged
Conversation
An arm whose expression is not a Task (`msg = rx.recv() => ...`, the spec's first example) was refused: "select await arm requires a Task value". Now Sema records such an arm (`select_arm_spawn_types`, the Task[T] the select races) and binds the arm's name to the expression's own type; MIR lowers the expression as an async block whose body is the expression (`lower_async_body`, shared with NK_ASYNC_BLOCK, through `prepare_anonymous_body_of`), so the existing select, await, cancel and cleanup protocol sees a Task and codegen spawns the fiber from the same constant an async block uses. A loser parked in recv() is cancelled at that suspension as before. A Task-typed expression the checker cannot await still gets the refusal, now naming the arm's type. Fixtures: the open conformance fixture moves to test/behavior (a receive racing a parked task); a second races two receivers across two selects. The conformance row flips to implemented.
ehartford
marked this pull request as ready for review
November 3, 2026 14:56
Contributor
Author
|
Battery green on 6474f30 (seed-driven: gate, uat, battery-checks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2956.
An arm whose expression is not a Task (
msg = rx.recv() => …, §14.10's first example) was refused with "select await arm requires a Task value". Now Sema records such an arm (select_arm_spawn_types, theTask[T]the select races) and binds the arm's name to the expression's own type; MIR lowers the expression as an async block whose body is the expression (lower_async_body, shared withNK_ASYNC_BLOCK), so the existing select, await, cancel and cleanup protocol sees a Task and codegen spawns the fiber from the same constant an async block uses. No codegen change. A loser parked inrecv()is cancelled at that suspension as before. A Task-typed expression the checker cannot await still gets the refusal, now naming the arm's type.Fixtures: the open conformance fixture moves to
test/behavior(a receive racing a task parked on a quiet channel; the loser unwinds and its channel is untouched); a second races two receivers across two selects. The conformance row flips to implemented.Iterate tier: both fixtures failed on the installed compiler; on the stage1 they pass,
--validate-all: ok, the 51 async/channel/select behavior fixtures pass, ceremony census diff ok. Gate green (412 s). Draft until the battery is green.