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
let-else success path cancels the subject's drop instead of consuming it: validate-all reports a leak for a Copy-payload match #1750
Spec: §9.7 (let ... else), §2.4 (every owned value dropped exactly once). Found while verifying #1384 on main 3ccb998.
fn items(k: i32) -> Result[i32, str]:
if k == 0: return Err("none".clone())
1
fn refutable(k: i32) -> i32:
let Ok(v) = items(k) else: return -1
v
fn main:
print(f"{refutable(0)}")
run --debug-alloc: -1, leak count=0. check --validate-all: owned local _3 is still Init at return — no path drops or moves it (a leak).
MIR of refutable: the fail block drops _3 (#1365's fix), but the success block (bb4) neither drops nor consumes _3: lower_let_else cancels the subject's scheduled scope-exit drop on the success path (cancel_scheduled_value_drop_for_local). With a Copy payload nothing is owned on that variant, so there is no runtime leak today, but the MIR states an owned value that is never released, and the validator is right to reject it. With an owned payload the ignored parts are moved into temporaries and dropped, and the validator passes (it sees the moved sub-place).
Expected: the success path keeps the subject's scope-exit drop (moved-out fields are already blanked, so the drop frees only what remains); validate-all passes; the debug allocator stays at 0. Ownership change: battery with :drop-audit/:move-audit.
Activity
MIR: a let-else's success path keeps its subject's cleanup — it is re…
MIR: a let-else's success path keeps its subject's cleanup — it is re…
MIR: a let-else's success path keeps its subject's cleanup — it is re…
MIR: a let-else's success path keeps its subject's cleanup — it is re…
MIR: a let-else's success path keeps its subject's cleanup — it is re…
Wipe's compiler issues: float joins, -> Unit bodies, method .Variant,…