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
Move checker: partial (field) move on a divergent branch wrongly poisons the fall-through #695
Pre-existing latent precision bug in the move/borrow checker, found while inventorying #691 (it surfaces at ~140 compiler-source sites once POD Vecs need drop, but reproduces on the shipped compiler with any Drop-bearing field).
Repro (shipped compiler, exit 1)
type D { id: i32 }
impl Drop for D:
fn drop(move self: Self): ()
type B { d: D, n: i32 }
fn pick(cond: bool) -> D:
var b = B { d: D { id: 1 }, n: 0 }
if cond:
return b.d // moves b.d ONLY on the returning (divergent) branch
b.d // ERROR: use of moved value — but this path never took the move
fn main:
print_i32(pick(false).id)
error: use of moved value at the fall-through b.d.
Root cause
The checker handles whole-value divergent moves correctly — the identical shape with a local (return v then use v) compiles and runs. It's specifically partial (field) moves through a divergent branch: return b.d inside if cond: marks b.d moved, and the move is (incorrectly) considered live on the fall-through even though the branch that performed it returns (diverges). A precise analysis knows the move cannot reach past a divergent terminator.
Why it matters
Correctness/ergonomics on the shipped compiler: a legal partial-move-on-one-branch pattern is rejected.
In the move/borrow dataflow, a move performed on a path that ends in a divergent terminator (return/break-out/panic/unreachable) must not propagate the moved-state to the join with the non-diverging paths. Same treatment the whole-value case already gets — extend it to projected (field/index) place moves. Repro becomes a behavior fixture; add the whole-value control case alongside so the two stay pinned together.
Follow-up landed in ee4e5f4: beyond the original divergent-branch poisoning, the branch-merge of the partial-move set (set_moved_field_union) concatenated instead of dedup'ing — a field moved on both arms was re-added at every merge, growing the moved-field arrays ~2^N across nested branches (~100 GB compile under the #691 flip). Fixed with a membership check before union; pinned by test/behavior/behav_nested_branch_field_moves.w and guarded by the new tools/move_audit.w matrix.
Triage 2026-08-31: CLOSE (overcome by events). Fixed by 2f330e5 "divergence-aware branch merge for the partial-move set (#695)" + ee4e5f4. The D32-legal respelling (explicit move b.d on the divergent branch and fall-through) compiles and runs correctly; the original repro's implicit spelling is separately a D32 §2.2 compile error now.
Activity
ehartford commentedon Jul 21, 2026
Follow-up landed in ee4e5f4: beyond the original divergent-branch poisoning, the branch-merge of the partial-move set (
set_moved_field_union) concatenated instead of dedup'ing — a field moved on both arms was re-added at every merge, growing the moved-field arrays ~2^N across nested branches (~100 GB compile under the #691 flip). Fixed with a membership check before union; pinned bytest/behavior/behav_nested_branch_field_moves.wand guarded by the newtools/move_audit.wmatrix.Sema: divergence-aware branch merge for the partial-move set (#695)
Sema: correct loop-carried move checking — continue back-edge guard (#…
ehartford commentedon Aug 31, 2026
Triage 2026-08-31: CLOSE (overcome by events). Fixed by 2f330e5 "divergence-aware branch merge for the partial-move set (#695)" + ee4e5f4. The D32-legal respelling (explicit
move b.don the divergent branch and fall-through) compiles and runs correctly; the original repro's implicit spelling is separately a D32 §2.2 compile error now.Build graph, seed, Sema and c_import fixes: stale-input records, seed…