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
Checker accepts owning-field read through a view as a silent aliasing bit-copy (move-out-of-borrow unrejected) #730
owned_local = (&container[i]).owning_field compiles silently. For a non-Copy
field type (Vec-bearing struct, pool, list) the compiler emits a bit-copy of the
handle, so two owners share one buffer: the local's scope-exit drop frees the
container element's buffers while the element keeps its pointers. Rust-safety
requires this to be rejected (cannot move out of a borrow) or satisfied by an
explicit clone; D22 says a &T materializes an independent T only under owned
demand — an aliasing bit-copy is not independent.
Sibling of #715 (element copies via vec[i]/vec.get) — this is the field
projection through a reference shape, so the #607/#715 gate discussion doesn't
cover it.
Manifestation (proven, fixed at the use site in 4e7294f)
The lsp-use-std selfhost case crashed release-only with panic: integer overflow: i64 multiplication out of range after a correct
completion response. Watchpoint timeline on the corrupted header:
LspState.publish_diagnostics ran dl = (&self.documents[idx]).cached_diags; dl's drop walked the document's cached DiagnosticList, blanked each
Diagnostic's nested vec header, freed the buffers (document kept pointers).
LspState.completion's str_concat_n_copy reused the freed block for the
response JSON.
Shutdown drop of LspState.documents walked JSON bytes as Vec headers; with_vec_free_drop_origin panicked on cap * elem_size over garbage.
Six LSP functions had the same merge-into-owned-local shape; all were converted
to if-expression view joins in 4e7294f. The compiler still accepts the pattern
everywhere else.
Repro shape
type Inner { items: Vec[i32] }
type Outer { inners: Vec[Inner] }
...
let v = &outer.inners[0 as i64]
let copy = v.items // should be rejected or deep-cloned; today: bit-copy
// copy's drop frees outer.inners[0].items' buffer; Outer's drop frees it again
Expected
A diagnostic at the read site (move out of borrow requires clone), or D22
materialization as a genuinely independent value. Silent aliasing is the one
outcome that cannot stay.
Fixed in eb0a0cf (isolated battery green including move/drop audits, reseeded).
Per D22 rule 3 and §13.6 the resolution is rejection, not an implicit clone: an owned demand may be satisfied from &T only when T is Copy, and the ruling explicitly forbids satisfying it through a hidden Clone. Field access through a shared view now records the non-Copy projection, and the owned-demand consumption sites (let bindings, assignments) reject it with a message naming the type and the three legal repairs — borrow the field, clone it, or restructure so the owner transfers. Reads, borrows, receivers, and Copy leaves are unaffected.
First catch was in the compiler itself: comptime_eval_finish drained four owned members (pending diag, extras, effect records, synced sema) out of a &ComptimeEvaluator; it now consumes, which is what the body always meant. Pinned by test/compile_errors/err_view_field_steal_non_copy.w and test/behavior/behav_view_field_copy_leaf.w.
Follow-up tracked separately: call-argument and struct-literal-field owned demands are not yet gated by the same fact table — same helper, more consumption sites.
Activity
ehartford commentedon Jul 27, 2026
Fixed in eb0a0cf (isolated battery green including move/drop audits, reseeded).
Per D22 rule 3 and §13.6 the resolution is rejection, not an implicit clone: an owned demand may be satisfied from &T only when T is Copy, and the ruling explicitly forbids satisfying it through a hidden Clone. Field access through a shared view now records the non-Copy projection, and the owned-demand consumption sites (let bindings, assignments) reject it with a message naming the type and the three legal repairs — borrow the field, clone it, or restructure so the owner transfers. Reads, borrows, receivers, and Copy leaves are unaffected.
First catch was in the compiler itself: comptime_eval_finish drained four owned members (pending diag, extras, effect records, synced sema) out of a &ComptimeEvaluator; it now consumes, which is what the body always meant. Pinned by test/compile_errors/err_view_field_steal_non_copy.w and test/behavior/behav_view_field_copy_leaf.w.
Follow-up tracked separately: call-argument and struct-literal-field owned demands are not yet gated by the same fact table — same helper, more consumption sites.
D5 batch fallout: restore-shaped state transfers consume; primitive t…
ComptimeEval: store_workspace_record consumes its record
migrate_shareplace: select §3.8 conformance targets post-classifier
Sema: reject owned demands satisfied from a non-Copy field of a view (#…
D27 rulings 1+3 implementation: JsonView is a Copy token; a typed let…
D27: make positional element access observe through views (#740)
sema: a let-bound element view registers its borrow (#887)