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
Field value read through shared borrow moves out of the borrow (blanks caller state / aliases buffer) #780
type F { name: str }
fn get_name(f: &F) -> str: f.name
fn get_name_ret(f: &F) -> str:
if f.name.len() > 0:
return f.name
"empty"
fn main:
let f = F { name: "hello" ++ "" }
print(get_name_ret(f)) # hello
print(get_name_ret(f)) # empty <-- f.name was BLANKED through the borrow
Actual MIR
Explicit return: _0 = move _1.*.f350; _1.*.f350 = const zst — moves AND blanks the caller's field through the &F param.
Tail form: _0 = move _1.*.f350 with no blank — caller and callee then both own the same buffer (latent double free).
Expected (D22)
An owned-value demand on a place rooted through a shared borrow materializes an independent value (for str: concat copy), or is rejected. It must never move out of borrowed content.
Impact found in the wild
analysis_fact_field (return fact.name through &AnalysisFact) blanked every fact name during the filter pass, so any second render (the matrix:name~… needs-codegen path) matched zero rows — deep-debug-tool-tests' analyze-matrix probe failure, plus the corrupt-vec-header panic on the same run.
Fix landed
MirLower NK_FIELD_ACCESS value arm: when the base chain passes through a &T link and the field is str, emit the two-part RK_STR_CONCAT_N [copy place, ""] independent copy instead of OK_MOVE.
Residue (this issue tracks it)
Non-str drop types (Vec, HashMap, user Drop structs) through a shared borrow still move out (same corruption class).
Sema should either reject or record the materialization uniformly (the lowering-side gate is a physical fix).
Read receivers typed as the value type (IndirectPlace self) are not covered by the &T-typed-base detector; verify and extend.
Triage 2026-08-31: CLOSE (overcome by events). D32 (§2.2, landed 839696a) makes every form in this issue a compile error: str via return f.name, the non-str Drop-type variant, and the read-receiver self.name all reject with "a field never moves out implicitly (§2.2, D32)" (three probes, 2026-08-31). The move-out-through-borrow corruption class is unrepresentable.
Activity
mir: str field read through shared borrow clones instead of moving (#780
mir: #780 borrow-clone gated on an owned-str demand
sema/mir: explicit owned demand materializes a str view (#781)
ehartford commentedon Aug 31, 2026
Triage 2026-08-31: CLOSE (overcome by events). D32 (§2.2, landed 839696a) makes every form in this issue a compile error: str via
return f.name, the non-str Drop-type variant, and the read-receiverself.nameall reject with "a field never moves out implicitly (§2.2, D32)" (three probes, 2026-08-31). The move-out-through-borrow corruption class is unrepresentable.