Repository navigation
Description
Revision (git rev-parse HEAD)
8fb92385a54f3934959c1ff059cb13f2ffe2e78d (origin/main, 2026-10-14 19:51 UTC). Also reproduced on the heads of open PRs #32 (8d9c9ba) and #34 (36e93f6) - not covered by either. Related but distinct from the fix for this file in PR #74 (call-result sharing, issue #73): that PR edges call results; this gap is about moving a share peer and exists for the LEXICAL form too.
Summary (Bounty Track #5 - Soundness P0)
check_non_owned_move (freeze.rs) derives non_owned_origin from the binding's own origin or its aliases-chain root only. The may-share graph (#27/#35 - undirected, covering shallow struct/array copies, projections, composite captures) is not consulted, and record_alias's define-time origin inheritance only fires for reference-alias shapes (Map/Slice/Pointer). So for a struct/array/unknown-shaped peer of a parameter:
m2 := m(map param) ? correctly rejectedHYB-E3004"cannot movem2. not parameterm" (alias + inherited origin).h2 := h(struct param carrying a map) ?h2gets a may-share edge but no origin, sotask worker(move h2, done)insideouterpasses withOK (0 diagnostics)while the caller keeps a live binding to the same storage - a real race.
The checker's own O5.1 rationale (the E3004 note text: "the caller retains the argument across intra-task calls") applies identically when the moved local is a share peer of the param: the storage is not exclusively owned by the sending frame, so the freeze cannot reach the caller's binding.
Minimal repro
// param-struct3.hy (main @ 8fb9238)
struct holder {
m map[string]int
}
fn worker(h holder, done chan<- bool) {
for i in 0..10000 {
h.m["k"] = i
}
done <- true
}
fn outer(h holder, done chan<- bool) {
h2 := h // shallow struct copy: may-share peer of param h
task worker(move h2, done) // ACCEPTED - should be HYB-E3004 like the map twin
}
fn main() {
h := holder{m: map[string]int{"k": 0}}
done := make(chan bool, 1)
outer(h, done)
for i in 0..10000 {
h.m["k"] = i // caller writes the same map worker is writing
}
<-done
}hyb check param-struct3.hy ? OK (0 diagnostics).
hyb build --emit-go emits outer: h2 := h; go worker(h2, done) while main loops h.m["k"] = i.
go run on the emitted file: fatal error: concurrent map writes (reproduced).
Negative control (same main, same shapes, map instead of struct)
fn outer(m map[string]int, done chan<- bool) {
m2 := m
task worker(move m2, done)
}? HYB-E3004 cannot move m2 (map[string]int) - move requires an exclusively owned local binding, not parameter m . (O5.1 / O5.4).
The struct/array form must behave identically - the storage-identity argument is the same; only the recorder differs (alias+origin vs share-edge-only).
Expected
Reject the repro with HYB-E3004 (O5.1: move requires an exclusively owned local binding) - the same diagnostic the map twin emits.
Actual
OK (0 diagnostics)
(emitted Go then fatals at runtime)
Claimed severity
P0 - data race reachable in the checked subset
Anything else
- Tier-0 rules involved: O5.1 move exclusivity (a param - and anything sharing its storage - is not exclusively owned by the sending frame), O5.2 freeze reach (freezing
h2cannot freeze the caller'sh). - Suggested fix direction (not prescriptive): in
check_non_owned_move, when the binding's own origin and alias-root origin areNone, scanst.share_group(name)(and each peer's alias root) for any peer binding withnon_owned_origin: Some(...)and reject with that origin - the map/alias path already does the equivalent via define-time inheritance. Corpus/units should pin: struct peer of param (reject), array peer of param (reject), map peer of param (existing reject - regression), pure-local peer (still accept). - Also checked: heads of open PRs fix(hy-check): scope aliases across blocks, break alias cycles, and reject same-stmt double moves (#31) #32 (
8d9c9ba, alias scoping) and fix(hy-check): validate binding shape on class-3 moves and track addr-of borrow aliases (#33) #34 (36e93f6, move shape classification) - both stillOK (0 diagnostics)on this repro; neither consults the share graph at move time either. - Distinct from closed Soundness: move on function parameter, closure capture, or non-channel range variable accepted with 0 diagnostics, causing concurrent map writes (HYB-E3004 / O5.1-O5.4) #60/fix(hy-check): reject boundary move of non-owned parameter, closure capture, and non-channel range bindings (HYB-E3004) #61 (those rejected moving the param binding itself - this rejects moving a local share peer of it; the param itself is never the
moveoperand here). - Platform: checker-side; reproduced on Windows amd64, no platform-specific paths.
- AI-assisted report (MiMo agent via opencode); reporter of record: @milkingndb-oss.
Activity
rickymulya commentedon Oct 14, 2026
Opened fix PR #80:
Traverses
st.share_group(name)incheck_non_owned_moveto detect non-owned origins across shallow struct/array copies and projections. Rejects withHYB-E3004(O5.1 / O5.4).Includes regression tests for struct/array parameter peers and positive control for pure locals.
Batch W (issue #75): moving a may-share PEER of a non-owned binding r…
Merge Batch W: may-share peer of non-owned move rejects (issue #75) —…
gelismarvel commentedon Oct 17, 2026
/claim #75
Fixes #75
Submitting verified fix PR for #75.
refactor(hy-check): deduplicate non-owned peer/alias transfer and add…
fix: resolve Moving a may-share peer of a parameter escapes the O5.1 …
Merge pr-410 (exantiv, fixes #75): non-owned peer/alias transfer for …