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
validate-ownership is silent on a move out of an already-moved place (guarded match arm double free passed) #1414
fn get() -> Option[Vec[i32]]: ... // 100 elements
match get():
Some(v) if v.len() > 500 => print("long")
Some(v) => print(v.len())
None => ...
The guarded arm binds _5 = move _3<as v0>.f0, the guard fails and drops _5, and the next arm binds _12 = move _3<as v0>.f0 again: run --debug-alloc reports DOUBLE FREE (size=512 origin=Vec). --validate-all said ok. The #1394 PR fixes the lowering (a failed guard moves its bindings back into the subject), but the validator still has no rule for it.
The natural rule — reject an OK_MOVE of a drop-bearing place whose drop state is Moved or Maybe — was tried in the #1394 branch and reverted: the drop-state lattice's Maybe is the join of any two different states, so it conflates "moved on some path" with "uninitialized on some path". It fired on every match result temp (_16 = move _18 in one arm, the unreachable no-arm path leaves _16 Uninit, then _14 = move _16 at the join) and on prelude bodies. The rule needs a lattice that keeps maybe-moved distinct from maybe-uninit (or a separate may-moved bit), then the check. Coordinate with #1353 (drop-state storage).
Activity
validate-ownership: a statement move of an already-moved place is rej…
validate-ownership: a statement move of an already-moved place is rej…
MIR: a borrowed receiver is lowered as a read; validate-ownership jud…
validate-ownership: a drop of a place moved out and not yet reset is …
validate-ownership: a drop that reaches a path where the place holds …
Ownership: D72 liveness byte, D73 assignment-as-read, validator leak/…