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 non-Copy ownership duplicated through borrowed MIR places #1132
with check --validate-all --dump-mir accepts an owning copy of a non-Copy value through a shared reference. The copied header is then dropped, freeing the original owner's storage.
use std.collections.Vec
fn observe(source: &str):
let value = *source
assert(value == "alpha")
fn main:
var values: Vec[str] = Vec.new()
values.push("alpha".clone())
observe(values.get(0))
assert(values.get(0) == "alpha")
Run with WITH_DEBUG_ALLOC=1 WITH_ALLOC_NO_REUSE=1 WITH_DEBUG_ALLOC_SCRIBBLE=1 with test repro.w: the assertion after observe fails. Validation exits zero and emits:
The same lowering in str.cmp corrupts owning SortedVec strings. LLDB observed with_str_free_drop_origin at rt_core.w:2730 returning owned=1 for the left comparison operand; the call came from the inlined str.cmp in the C comparator. The native address trap reported trap-free hit=1 ... origin=drop#struct __drop_struct_16 for that live collection element's payload.
Root producer: MirLower.lower_binding_alias_place omits dereference projections, so lower_let_binding falls through to an owning local; lower_unary emits OK_COPY through the shared reference. The Phase 1 fix records the borrowed projection in Sema and consumes it as a place alias in MIR. This issue tracks the independent validator gap: an owning non-Copy copy through a shared borrow must fail validation unless an explicit materialization/clone establishes an independent owner.
Acceptance: reject the malformed MIR above, accept legitimate borrowed aliases and explicit clones, and retain coverage for equivalent field and dereference projections. D22 §§5, 13.6 and the ownership contract require that observation never acquires the source's drop obligation.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce (in today's spelling: Vec is List, D118, and a positional collection is indexed, D71).
$ cat main.w
fn observe(source: &str):
let value = *source
assert(value == "alpha")
fn main:
var values: List[str] = List.new()
values.push("alpha")
observe(values[0])
assert(values[0] == "alpha")
print("ok")
$ with run --debug-alloc main.w
ok
debug-alloc: leak count=0 allocations=2
Activity
stdlib sourcing Phase 1: the c-algorithms corpus, its upstream tests,…
C algorithms phase1 (#1142)
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce (in today's spelling:VecisList, D118, and a positional collection is indexed, D71).