Repository navigation
fix(hy-check): track multi-return and try-unwrapped auto-addr loans (fixes #2052) - #2139
Open
jpereyra243-byte wants to merge 1 commit into
Conversation
jpereyra243-byte
force-pushed
the
fix/collect-borrowed-roots-multi-return-try-2052
branch
from
October 30, 2026 14:33
a780617 to
ea913af
Compare
This was referenced Oct 30, 2026
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 provenance and borrow-classification soundness gaps in
compiler/crates/hy-check/src/loans.rsthat allowed multi-return calls and?-unwrapped calls on auto-addressed*Treceivers or*Tparameters to bypass O5.2 (HYB-E3003post-move alias freeze), O5.1 / O5.4 (HYB-E3004non-owned parameter laundering), and T22 (HYB-E3006deepconstimmutability) with 0 diagnostics, resulting in data races undergo run -race:Checker::collect_borrowed_roots: Addedcall_any_result_may_share(st, callee)so multi-return functions and methods returning a non-sharing primitive in result 0 (e.g.(int, []int)or(int, holder)) correctly identify auto-addressed*Treceivers and parameters as carrying borrowed GC storage.Checker::expr_has_borrow_shape: UnwrappedExpr::Try(?) before inspecting multi-return call results, ensuring fallible methods returning pointers (e.g.(int, *cell, error)) properly mark the auto-addressed receiver as borrowed.Fixes #2052.
Changes
compiler/crates/hy-check/src/loans.rs:call_any_result_may_shareinspecting all tuple return types ofcallee.Expr::Tryinexpr_has_borrow_shape.call_any_result_may_shareincollect_borrowed_roots.multi_return_and_try_auto_addr_borrow_soundnesscovering O5.1/O5.4 (HYB-E3004), T22 (HYB-E3006), and O5.2 (HYB-E3003).Settlement / Payout Wallet (Polygon / USDC):
0xC175c34c256598C7e1AD5B15503cFcED7Ed67e10