Repository navigation
checker: freeze all may-share aliases on move (fix #27) - #35
Merged
limitlessprojects merged 1 commit intoOct 14, 2026
Merged
limitlessprojects merged 1 commit into
limitlessprojects merged 1 commit into
Conversation
- extend freeze to union may-share component from aliases so struct/array shallow copies, reslices, projections, and composite-literal captures freeze peers - record may-share edges on local/assign for Ident/shallow copies, Expr::Slice (s1[:]), Field/Index projections (including when they carry reference interior), and composite literals - add shape_may_share (Map/Slice/Pointer true + transitively Struct/Array); keep is_reference_alias used as base - union may-share in mark_move; is_alias true if aliases or may_share has name - clear may_share on rebind/redefine; avoid recording consts - fixes P0: struct/array shallow copy bypassing O5.2 freeze; rejects limitlessprojects#27 repros and keeps corpus/CI green
This was referenced Oct 14, 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.
What
Fixes #27 — a
movenow freezes every binding that may share mutable GC storage with the moved value, not just the single-parent alias chain.Three soundness gaps closed:
is_reference_alias()only classifiedMap/Slice/Pointeras aliases. A struct or array that carries a reference field/element is copied by value in Go, but the reference interior is shared — the freeze rule missed it.Expr::IdentRHS, so shallow copies / re-slices / projections / composite literals were never recorded.mark_movefroze only the old single-parentaliasescomponent, leaving those peers live.Changes
model.rs—FnState::may_share(undirected graph) +share_edge/share_clear/share_group; cleared on redefine/rebind.shape.rs—Checker::shape_may_share(): true for map/slice/pointer (viais_reference_alias), recurses transitively intoStruct/Array; bounded depth.loans.rs—binding_may_share/record_may_share/record_literal_ref, called fromprocess_localandprocess_assign. Handles all four reported forms:h2 := h1— shallow struct/array copy of a reference-bearing value(shared),s2 := s1[:]— parenthesized / re-sliced RHSm2 := h1.m,m2 := arr[i]— field/index projectionh := holder{m: agg}— composite literal capturing a live bindingfreeze.rs—mark_moveunions the may-share component;emit_use_after_movetreats a use as an alias if it is inaliasesormay_share.Why this is safe
aliasespath is unchanged for plain reference-typed ident copies, so existing diagnostics/wording and all current corpus verdicts are preserved.Unknown.Verification
Repro (from the issue):
h2 := h1; task worker(move h1); h2.m["k"] = ...d01)-race: DATA RACE +concurrent map writesHYB-E3003(frozen alias)d03)-race: DATA RACEHYB-E3003HYB-E3003d04no-move controlHYB-E3001HYB-E3001(unchanged)d05direct use-after-move controlHYB-E3003HYB-E3003(unchanged)cargo testworkspace: green — hy-check lib 50/50, hy-syntax 87, hy-emit 77, hy-diag 8, spike6 2/2.hybrebuilds clean.Notes
A1bfor the frozen-alias diagnostic (consistent with existing move freeze).