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
Ownership audit accepts duplicate cleanup of a moved enum payload and its carrier #1177
The cleanup work for #1172 exposed a double drop that audit:all accepts (facts=11504 violations=0 ok). This is related to #1170 but involves moving a projected enum payload, then dropping the enclosing enum after dropping the binding.
Repro:
var drops = 0
type Owned { text: str }
impl Drop for Owned:
move fn drop(): drops += 1
fn make() -> Option[Owned]: Some(Owned { text: "held".clone() })
fn stop():
match make():
Some(value) => { assert(value.text == "held"); return }
None => return
fn main:
stop()
assert(drops == 1)
The assertion fails with the candidate #1172 compiler. Its MIR moves _2<as v0>.f0 into _4, then emits drop(_4) and drop(_2) on the same return path. LLDB stops in MirBuilder.emit_drop_entry with w1=4, w2=0 and then w1=2, w2=0, both from emit_drops_for_return. The second call is at emit_drops_for_return+308. lower_match+1276 lowers the returning arm before lower_match+1480 cancels the carrier's statement cleanup.
The original behav_regex_std.w retained runner binary reports an allocator DOUBLE FREE in Regex.replace_fn: the Captures binding and enclosing Option[Captures] both destroy the same PCRE allocation. Address trap free hit 12 at address 4295840464 reaches Captures.drop at executable address 0x100003884; the duplicate free reaches 0x1000038cc. The line reducer retained an eight-line regex callback reproduction.
Expected: the ownership audit must reject cleanup of an aggregate whose moved payload has not been reset or excluded from that cleanup. It must account for the payload's actual state rather than accepting the aggregate as wholly initialized.
Evidence: out/with-get-investigation/return-temps-match-audit-before.log, return-temps-match-double-drop-lldb.log, return-temps-match-mir.log, return-temps-regex-first-free-lldb.log, and return-temps-regex-address-lldb.log. Filed in the same batch as the lowering repair; the validator root still needs instruction-level investigation.
Activity
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce.