You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6167af4
Browse filesBrowse the repository at this point in the historyBrowse files
feat(borrow): CORE-01 ref-to-ref binding (#177 pt3) — let r2 = r and r = s now alias the borrow-graph
Closes the reborrow-through-indirection gap documented at
lib/borrow.ml's "Still deferred" comment:
- `let r2 = r` (where r is itself a ref-binder) now copies r's
borrow-graph entry to r2 via a new `ref_source_borrow` helper.
Pre-fix, the alias was never recorded — r2 had no entry, so
subsequent uses of *r2 lost protection of the underlying owner.
- `r = s` (assignment, RHS = another ref-binder) now goes through
the same Slice B pre-release + re-alias path that already
handles `r = &y`. `is_reborrow_source` unifies the &p / &mut p
/ ref-var shape test.
- `expire_dead_ref_bindings` now reference-counts borrows by
`b_id` across surviving bindings: a borrow is ended only when
no live ref-binder still aliases it. This was the load-bearing
fix — without it, `let r = &x; let r2 = r` would correctly
record r2 but then drop the borrow when r died, silently
re-permitting writes to x while r2 was still in flight.
Tests (+3, all green):
- ref_to_ref_let_aliases: positive let-path
- ref_to_ref_protects_owner: anti-regression (assign through
owner while alias is live must be rejected)
- ref_to_ref_assign_aliases: positive assign-path mirror of
slice_b_outer_assign_releases_old with RHS = ref-var
Gate: 327 → 330 tests, 0 failures under `dune runtest --force`.
Refs #177, CORE-01 pt3 (ref-to-ref).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments