Repository navigation
fix(hy-check): track call may_share and post-closure const rebinds in scan_block_const_writes (fixes #2059) - #2138
Open
jpereyra243-byte wants to merge 1 commit into
Conversation
… scan_block_const_writes (fixes limitlessprojects#2059)
jpereyra243-byte
force-pushed
the
fix/scan-block-const-writes-call-may-share-2059
branch
from
October 30, 2026 14:33
5761044 to
d3357a2
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
Fixes two deep
constimmutability (T22 /HYB-E3006) soundness gaps inChecker::scan_block_const_writes(compiler/crates/hy-check/src/loans.rs) that allowed closures to mutate package-levelconstmaps and slices across concurrenttaskboundaries with 0 diagnostics, producing immediate concurrent read/write data races (WARNING: DATA RACE) and runtime crashes undergo run -race:may_sharetracking: Inscan_block_const_writes,record_copy_may_shareandrecord_callee_param_storesare now invoked unconditionally across block walk iterations (even whencheck_writes == false), ensuring that containers populated withconstreferences via helper calls (store_into) orcopy()propagate theirmay_shareedges to closure bodies.may_shareedges merged viamerge_post_closure_const_state, while tracking lexical overwrite depths to avoid leaking shadowed variables.Fixes #2059.
Changes
compiler/crates/hy-check/src/loans.rs:record_copy_may_shareandrecord_callee_param_storesunconditionally for all calls.closure_const_writes_via_block_scoped_callee_store_copy_and_post_rebindverifying rejection withHYB-E3006across callee stores,copy(), and post-rebind patterns, as well as zero diagnostics on clean non-const stores.Settlement / Payout Wallet (Polygon / USDC):
0xC175c34c256598C7e1AD5B15503cFcED7Ed67e10