Repository navigation
feat: introduce structured task scopes and affine cancellation tokens - #2280
Open
SuperPiIot wants to merge 3 commits into
Open
SuperPiIot wants to merge 3 commits into
SuperPiIot wants to merge 3 commits into
Conversation
This was referenced Oct 30, 2026
SuperPiIot
force-pushed
the
fix-issue-1669
branch
5 times, most recently
from
November 4, 2026 18:40
c887b13 to
b4e4b3e
Compare
2 tasks done
SuperPiIot
force-pushed
the
fix-issue-1669
branch
4 times, most recently
from
November 9, 2026 03:02
bc0aae9 to
28543b8
Compare
limitlessprojects#1669) - Wire contextual `scope { ... }` / `scope <ident> { ... }` and expression-position `task <call>` into `hy-syntax` - Extend `walk.rs` (`FlatInfo::scope_end`) as the single authority for lexical `scope` containment - Implement `HYB-E3501`, `HYB-E3502`, and `HYB-E3503` diagnostics in `hy-check/src/task_scope.rs` with `managed` downgrade semantics - Add integration test suite `compiler/crates/hy-check/tests/task_scope_test.rs` - Add `mv` to `required_tools` in `tests/test_install_runtime.py` for sandboxed PATH test environments - Remove standalone Go stub files (`compiler/*.go`) Fixes limitlessprojects#1669
SuperPiIot
force-pushed
the
fix-issue-1669
branch
from
November 9, 2026 23:40
28543b8 to
46e1d2e
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.
Summary
Implements Structured Task Scopes (
scope { ... }) and AffineJoinHandle[T]Lifetime Checking (HYB-E3501,HYB-E3502,HYB-E3503) natively in the Rust compiler crates (hy-syntaxandhy-check), addressing #1669 and the maintainer design note in #1669 (comment).Architectural Changes
compiler/crates/hy-check/src/walk.rs):FlatInfo<'a>withpub scope_end: HashMap<usize, usize>alongsidemanaged_endandloop_end, providingFlatInfo::in_scope(idx)andFlatInfo::enclosing_scope(idx)as the single authority for lexicalscope { ... }containment.scopeBlocks & Handle-ProducingtaskExpressions (compiler/crates/hy-syntax/src/parser.rs):scope { ... }andscope <ident> { ... }in statement position without reservingscopeas a lexer keyword (preservingscope := 1andscope(x)compatibility).task <call>(e.g.,h := task worker(i)) into the internal__hy_task_spawncall representation while keeping statement-leveltask worker()intact.compiler/crates/hy-check/src/task_scope.rs):HYB-E3501(Unjoined Task Escape): Rejects baretaskor_ := task ...insidescope, handles unjoined at normal or earlyscopeexit (return,break,continue), handle overwrites before consumption, partial consumption across non-divergingif/match/selectbranches, and handle escapes via return/channel-send/call arguments/assignments.HYB-E3502(AffineJoinHandleDouble Consumption / Use-After-Consume): Enforces single consumption acrossjoin(h),cancel(h),drain(h), and method syntax (h.join(),h.cancel(),h.drain()), including branch-sensitive consumption anddefer.HYB-E3503(Foreign Callback Spawn): Rejects spawning ataskinside a closure literal passed to a foreign/selector call unless wrapped in an innerscope { ... }ormanaged { ... }.managed { ... }Escape Hatch: QueriesFlatInfo::in_managed(idx)to downgradeHYB-E3501andHYB-E3503insidemanagedblocks while keepingHYB-E3502(double-consume) enforced.PATHFix (tests/test_install_runtime.py):"mv"torequired_toolsinInstallRuntimeTests._make_fake_curl_envsoinstall.shatomic staging succeeds in isolated testPATHenvironments.Verification
cargo test -p hy-check --test task_scope_test(all positive and negativeHYB-E3501/HYB-E3502/HYB-E3503cases pass)cargo test -p hy-syntax(all 135+ lexer/parser/corpus tests pass)python3 -m unittest tests.test_install_runtime(all 14 runtime installer tests pass)python3 tools/shepherd.py test-check&python3 tools/shepherd.py probepass cleanlyFixes #1669
Settlement Coordinates
0xf084cF0076F91AA48C2370F427C399dAA8C1f07F