feat(concurrency): support multi-statement fork bodies - #2923
Open
slepp wants to merge 3 commits into
Open
Conversation
slepp
force-pushed
the
feat/multi-statement-fork-body
branch
from
August 17, 2026 08:45
ce89794 to
385f46c
Compare
Contributor
Author
|
I rebased this onto current main and force-pushed |
hir-publication-consumer count for hew-hir/src/lower.rs rises from 358 to 359: the multi-statement fork body lowering reads closure_capture_facts to materialize fork block captures, mirroring the existing closure-literal capture read.
slepp
force-pushed
the
feat/multi-statement-fork-body
branch
from
August 19, 2026 07:46
385f46c to
0d9836e
Compare
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 #2912.
A
fork { ... }body was limited to a single direct call: the parser accepted full blocks, HIR rejected multi-statement and non-call bodies, and MIR lowered only the direct-call shape. A server accepting a connection could not move it into a concurrent child, forcing sequential handling.Multi-statement fork bodies now lower through the scoped-children machinery. A value created in or moved into the body is owned by the child, and its drop obligation follows the child through completion, crash, and cancellation while suspended — all three paths release exactly once, proven by the lifecycle oracles. A borrow of parent state that would dangle across the fork boundary is refused with a diagnostic naming the binding, pinned by a reject fixture.
Concurrency is proven rather than asserted: the accept fixture starts two slow children and observes both begin before either completes, under O0 and O2.
Verification
Checker, HIR task-gate, MIR cancellation-scope, codegen structural, and runtime lifecycle suites pass. The O2 differential reruns 1,328 outcomes identically. The compiled Hew ratchet passes. Suspending expressions directly inside fork-body closure shims remain outside the current codegen ABI; a coroutine-driving task wrapper is the follow-up before admitting them.