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
Option/Result map / and_then / map_err / or_else never retire the subject they decompose — DOUBLE FREE (main: map((v) => v); #1398 branch: every map/and_then) #1424
Mechanism: lower_option_combinator_method / lower_result_combinator_method (src/MirLower.w) move the payload (move _7<as v0>.f0) into the closure call or the result, and leave the materialized subject's scope-exit drop live (drop(_7) @ scope-exit). A move out of a variant payload registers no reset-on-move.
On main, a closure does not drop its owned parameter, so the subject's drop is the only free, unless the closure hands the payload back ((v) => v).
The observing combinators (filter, Option.inspect, Result.inspect / inspect_err / context / with_context) are fixed in #1422, which adds retire_decomposed_carrier. The consuming ones need the same retire once closures own their parameter, which means landing alongside #1398's closure change.
Verified 2026-09-23: on the batch-X2 build (main 977e667, which includes #1398, plus #1404, #1418, #1419, #1425), all four repros run clean under run --debug-alloc (leak count=0, no DOUBLE FREE): o.map((v) => v), o.map((v) => v.len()), o.and_then((v) => Some(v.len())), o.filter((v) => v.len() > 0). The same four DOUBLE FREE on #1398's build. The fix is #1425's variant-payload reset-on-move (plus #1422 for filter). Closes when X2 merges; a debug_alloc fixture pinning these exact four lands with it.
Activity
ehartford commentedon Sep 23, 2026
Verified 2026-09-23: on the batch-X2 build (main 977e667, which includes #1398, plus #1404, #1418, #1419, #1425), all four repros run clean under
run --debug-alloc(leak count=0, no DOUBLE FREE):o.map((v) => v),o.map((v) => v.len()),o.and_then((v) => Some(v.len())),o.filter((v) => v.len() > 0). The same four DOUBLE FREE on #1398's build. The fix is #1425's variant-payload reset-on-move (plus #1422 for filter). Closes when X2 merges; a debug_alloc fixture pinning these exact four lands with it.test: map / and_then / filter over Option[Vec] free the payload once (#…
test: map / and_then / filter over Option[Vec] free the payload once (#…
test: map / and_then / filter over Option[Vec] free the payload once (#…