Skip to content

docs: Phase 2 closure capture works on every engine (PR5 of 5)#394

Merged
danieljohnmorris merged 5 commits into
mainfrom
feature/phase2-pr5-doc-cleanup
May 18, 2026
Merged

docs: Phase 2 closure capture works on every engine (PR5 of 5)#394
danieljohnmorris merged 5 commits into
mainfrom
feature/phase2-pr5-doc-cleanup

Conversation

@danieljohnmorris
Copy link
Copy Markdown
Collaborator

Summary

Final doc cleanup for the Phase 2 closure-capture rollout. After #384 (VM closures), #385 (Cranelift closures), #386 (window-view JIT), #387 (partition off bridge), #389 (mapr off bridge), and #391 (srt/grp/uniqby off bridge), Phase 2 closure capture runs natively on every engine with no per-engine fallback. This PR flips every "tree-only" / "Phase 2 is tree-only" claim across the doc surface and tightens a couple of stale error-text and code-comment leftovers.

Lands at the same time as #391; merge order doesn't matter, the doc claim becomes true either way once both are in main.

What's in the diff

  • docs: phase 2 closure capture works on every engine - SPEC's Inline lambdas section and the Default engine section both lose the "Phase 2 is tree-only" / "VM and Cranelift surface ILO-R012" wording. ai.txt and skills/ilo/SKILL.md are regenerated from SPEC via build.rs. SKILL.md's standalone gotcha line picks up the same flip.
  • vm: narrow CompileError::UnsupportedClosureCapture to the >255 cap - the variant is still reachable (the 8-bit capture-count field in OP_MAKE_CLOSURE genuinely caps at 255), but the message and doc comment used to say "tree-only" which is no longer true. Stray-Value::Closure comment in NanVal::from_value updated the same way.
  • diag: refresh ILO-P017 registry entry and parser doc comment - ILO-P017's registry long-form still described the original "inline lambda captures outer scope" meaning; the code is now used exclusively for use-import resolution. Rewritten to match. Stale parse_inline_lambda doc comment also fixed.

Test plan

  • cargo build --release --features cranelift regenerates ai.txt + skills/ilo/SKILL.md from the SPEC edits
  • cargo test --release --features cranelift - 6864 passed, 0 failed
  • cargo fmt --check clean
  • cargo clippy --release --features cranelift --all-targets -- -D warnings clean
  • Site repo grep for Phase 2 / tree-only / closure capture - no user-facing claims to flip there

Follow-ups

  • The four ILO-P017 emission sites in src/main.rs still point at the repurposed code; the parser path that used to raise ILO-P017 for closure captures is gone (Phase 2 handles those via MakeClosure instead). Out of scope for a doc PR; the runtime behaviour is correct and the registry now reflects what users actually see.

The tree-only caveats in SPEC's Inline lambdas section and the Default
engine section pre-date #384/#385/#386/#387/#389/#391. Closure capture
now runs natively on tree, VM, and Cranelift JIT/AOT with no per-engine
fallback. Flip the language in SPEC, then let build.rs regenerate
ai.txt and the SKILL.md mirror block. The standalone gotcha line in
SKILL.md picks up the same flip.
After phase 2 landed across the VM and Cranelift backends, the only
remaining unsupported case for OP_MAKE_CLOSURE is a single inline
lambda capturing more than 255 free variables (the 8-bit cap of the
instruction's count field). Update the error message and the variant's
doc comment to reflect that, and refresh the stray-Value::Closure
comment in NanVal conversion so it doesn't claim the VM bails on
captures.
ILO-P017 was originally the "inline lambda captures outer scope"
parser error. Phase 2 closure capture absorbed that code path, and
the code is now used exclusively for use-import resolution failures.
Rewrite the registry long-form to match its current behaviour, with
a note explaining where the closure-capture wording went. Also fix
the stale doc comment on parse_inline_lambda that still mentioned
the Phase 1 rejection path.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@danieljohnmorris danieljohnmorris merged commit 4dd6121 into main May 18, 2026
5 checks passed
@danieljohnmorris danieljohnmorris deleted the feature/phase2-pr5-doc-cleanup branch May 18, 2026 18:53
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.

1 participant