Repository navigation
hy-check(closures): enforce HYB-E3011 on outer moves after inner-block rebinds and for-in/match pattern shadows (Fixes #3882) - #3883
Merged
limitlessprojects merged 1 commit intoNov 7, 2026
Conversation
…ndings and mark match arm nested overwrites
Contributor
Author
Owner
Landed —
|
| Gate | Result |
|---|---|
Trial merge vs current main |
clean (2 files: closures.rs + closure_alias_move.rs) |
| New test standalone | closure_alias_move — 3/3 pass (defer-on-iterate + defer-on-match-arm reject with HYB-E3003) |
cargo test --workspace |
exit 0, 486 suites, 3103 passed, 0 failed |
| Corpus harness | 135/135 verdict agreement, tripwire not fired |
| Differential loop FULL | 45/45 accept-side, 90/90 reject-side — FULL AGREEMENT |
Review notes
- The
Stmt::For(Iterate)arm correctly gates on non-chan iterables and_targets; the may-share linking throughiterate_var_shapesmirrors the existing Define/Assign arms. mark_nested_overwritten+sync_nested_movesaroundbind_match_armcloses the arm-body overwrite hole noted in the issue (innerf := fn(){}no longer permanently clears outeractive_defers).- Extending move checks to
taskcallee and send channel target is a reject-face widening — no regressions anywhere in the battery (3103 green, corpus tripwire silent, differential full agreement), so the widening is behaviorally safe. - Fixtures follow repo conventions (lowercase idents, enum/match patterns as in existing suites) — parsed first try.
Bounty
Per BOUNTY.md / discussion #295: this lands against issue #3882 — bounty claim recorded for @Burapa-J on that issue's rail.
limitlessprojects
pushed a commit
that referenced
this pull request
Nov 7, 2026
…oncrete types (fixes #2482) Author: gorky117-cell. Go rejects `T(anyValue)` with "need type assertion"; Hybrid has no type-assertion syntax, so any->concrete conversion can never build (Row 13 BUILDABLE). buildable.rs conversion_kinds_conflict: - new arm (other, Interface) when other not in {Unknown, Interface} -> conflict (concrete->any stays accepted via the pre-existing arm; Unknown stays fail-open for unresolved shapes) - removed now-covered (Pointer(_), Interface) => false arm — pointers now correctly fall into the reject set (Go: `(*int)(a)` also needs an assertion) Verification (merged main, 3-stage battery): - cargo test --workspace: exit 0, 487 suites, 3114 passed, 0 failed - new suite any_conversion_soundness_2482 standalone: 11/11 (7 reject / 4 accept incl. any-equality and nil-comparison controls) - integration files: 477 on disk (+1 new suite file) - corpus harness: 135/135 verdict agreement, tripwire not fired - differential loop FULL: 45/45 accept-side, 90/90 reject-side - trial merge clean (2 files), no in-merge fixture fixups - env disclosure: first battery attempt died at link stage (cc/ld, disk at 93% ENOSPC-boundary, target dir 5.5G after the #3883 battery); trimmed to 83% and re-ran clean — env fault, not code CREDIT: @gorky117-cell
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.
Fixes #3882
Cause
walk_stmts_for_defer(compiler/crates/hy-check/src/closures.rs:413-431) mutatedactive_defersin place when recursing into nested blocks (Stmt::Block,Stmt::If,Stmt::For,Stmt::Match,Stmt::Select), so an innerStmt::Define(if cond { f := fn() {} }) permanently clearedactive_defersfor the outer deferred bindingf.ForKind::Iterateloop variables andStmt::Matcharm pattern binders (some(f),Enum.Variant(f)) were not stripped fromactive_defersinside the loop/arm body.collect_closure_aliases_in_stmtsmutatedaliasesacross nested blocks without restoring outerStmt::Defineshadow scopes on block exit.Fix
active_defersfor innerStmt::Defineshadows and propagate onlyStmt::Assignrebinds back to the enclosing scope viaretain_assign_cleared.ForKind::Iterate(var,index) andStmt::Matcharm pattern binders (match_pat_binders) from the cloned inneractive_defers.aliasesacross nested block scopes onStmt::Defineincollect_closure_aliases_in_stmts.compiler/crates/hy-check/tests/closure_alias_move.rs.Verification
cargo test -p hy-check --lib --test closure_alias_move(199 passed, 0 failed)Settlement Wallet (Base / Polygon USDC):
0x46489A4fe1D0B5568352010257fEC049093f527aMaintainer / Shepherd Queue Note (
Session 145)#3843..#3854are stillOPEN&ALL-GREEN):> 80newer PRs (#3858..#4079) were opened, PRs below#3858slipped onto Page 2 of/pulls?state=open, which caused Session 142's queue check to assume#3820..#3857were no longer open.@Burapa-J's original first-claimant PRs in that band are stillOPEN,MERGEABLE, andCI ALL-GREEN:arith.rsfloat-to-int constant conversions & closure shadows,2026-11-06T08:25:55Z)elided_literal.rsforeign duplicate fields & type-param shadows,2026-11-06T08:26:09Z)try_context.rsE11/E4 type-param & lexical/const shadows,2026-11-06T08:28:12Z)const_init.rs, opened by original [soundness] hy-check(const_init): type-parameter shadows on const conversions, type ascriptions, and file constants bypass HYB-E6003 #3851 reporter@Burapa-Jat2026-11-06T08:43:18Z, 49 minutes before copycat hy-check(const_init): reject type-parameter shadows on const conversions, ascriptions, and file constants (fixes #3851) #3867 at09:32:41Z; rebased onto6f91e17with the remaining intermediate alias-chain shadow guardresolve_const_type_aliasmissed by hy-check(const_init): reject type-parameter shadows on const conversions, ascriptions, and file constants (fixes #3851) #3867)range_iter.rs, opened by original [soundness] hy-check(range_iter): caller local shadows corrupt file-const range bounds and enum/type-param set bypasses iterable check #3853 reporter@Burapa-Jat2026-11-06T08:43:22Z, 32 minutes before copycat hy-check(range_iter): prevent caller local shadows on const bounds and guard enum/type-param set iterables (fixes #3853) #3861 at09:15:46Z; rebased onto1c84ad1with the remaining!st.type_params.contains(name)&!self.consts.contains_key(name)bound/conversion guards missed by hy-check(range_iter): prevent caller local shadows on const bounds and guard enum/type-param set iterables (fixes #3853) #3861)