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-all: the ownership validator never judged a read of a local on a path that never initialized it (a match's no-arm join) #1883
check --validate-all said ok over a value-position match whose no-arm path fell through to the join and returned the never-written result temp (#1860's sealed-trait match on *s: print("start"), then the process ended silently with exit 0). The ownership validator judged drops of a place on a path that never initialized it (#729, #1559) but never a read: _0 = copy _4 at the join, with _4 Init on the arm path and Uninit on the fallthrough (Maybe), passed.
Rule
A copy or move operand of a whole local whose drop-state at that statement is Maybe or MaybeGarbage (some reaching path never initialized it) is an error: "read of _N reaches a path that never initialized it (Maybe)". Uninit is not judged: StorageDead resets a local to Uninit and the lowering moves a block's tail local out after its scope's StorageDead by contract (_23 = move _27 after StorageDead(_27); materialize_tail_field_move).
With the rule in place, every value-position match tripped it: lower_match gave the last arm's failure edge the join block (MirLower.w:11373) even when Sema had proved the match exhaustive. That edge is now an unreachable block (Sema records the matches it proved exhaustive in exhaustive_matches; MIR consumes the fact).
Fail-before: test/internals/mir_uninit_read_test.w (a planted body: a switch whose one edge writes the local and the other does not, then a read at the join) fails against the validator at f9d0dfc4 and passes with the rule.
"A tool that stayed silent is a bug." Found while fixing #1860.
Activity
MirCore: the ownership validator refuses a read of a local on a path …
MirLower: terminate the continuation of a Never-typed call