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 deferred reads after a temporary iterable is dropped #1175
While fixing #1172, an intermediate (uncommitted) lowering change correctly
freed the temporary iterable on return but emitted that drop before defers
and local destructors. Runtime regression is being fixed in that same batch;
this issue tracks the analyzer that accepted the invalid lifetime.
fn observe(part: &str): assert(part == "bad")
fn stop(text: &str):
for part in text.split(","):
defer: observe(part)
return
fn main: stop("bad,old")
Expected: ownership analysis rejects the read through part after its
iterable owner has been destroyed. The declared borrow and defer lifetime
must hold (spec §§2.4 and 13.2).
Actual: the retained candidate panics, also with WITH_ALLOC_NO_REUSE=1,
while analyze ... audit:all reports facts=11547 violations=0 ok on the
explicit-main probe. The retained probe adds two small allocations in observe; these are not needed for the no-reuse failure.
Native proof: in the retained return-temporary-defer, LLDB at 0x100000694
observes element address 0x100068030 holding payload 4295393296, length 3,
immediately before with_str_free_drop_origin. At the deferred read,
0x100000744, both element words are zero. The allocator address trap WITH_DEBUG_ALLOC_TRAP_FREE=4295393296 with hit 1 stops on this free.
Compiler LLDB for stop (sym 330) shows MirBuilder.lower_return+268
calling temporary cleanup before +276 calls emit_defers_for_return.
Evidence under local out/with-get-investigation/: return-temps-defer-{free-read,trap,lowering}-lldb.log, return-temps-defer-explicit-audit.log, and return_temporary_defer_explicit.w. A local ephemeral destructor borrowing
the element reproduces the same ordering error. The repair merges temporary
drops with reverse local-drop order after defers; no audit exemption is used.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce; the runtime is correct and #1791 (bbd2241) added view liveness across blocks to the validator.
$ cat main.w
fn observe(part: &str): assert(part == "bad")
fn stop(text: &str):
for part in text.split(","):
defer: observe(part)
return
fn main: stop("bad,old")
$ with run --debug-alloc main.w
debug-alloc: leak count=0 allocations=3
Activity
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce; the runtime is correct and #1791 (bbd2241) added view liveness across blocks to the validator.