Skip to content

feat(concurrency): support multi-statement fork bodies - #2923

Open
slepp wants to merge 3 commits into
mainfrom
feat/multi-statement-fork-body
Open

feat(concurrency): support multi-statement fork bodies#2923
slepp wants to merge 3 commits into
mainfrom
feat/multi-statement-fork-body

Conversation

@slepp

@slepp slepp commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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.

@slepp
slepp force-pushed the feat/multi-statement-fork-body branch from ce89794 to 385f46c Compare August 17, 2026 08:45
@slepp

slepp commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

I rebased this onto current main and force-pushed 385f46cf397f. The branch contained two patch-identical copies of the feature and inventory commits; the rebased history keeps one copy of each. The focused HIR, MIR, codegen, and runtime tests pass, and CI is rerunning.

slepp added 3 commits August 19, 2026 01:31
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
slepp force-pushed the feat/multi-statement-fork-body branch from 385f46c to 0d9836e Compare August 19, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A multi-statement fork body is unsupported, so accepted connections cannot be handled concurrently

1 participant