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
A global str returned by name is moved out, not copied: return g blanks the global, and a global assigned inside a block gets a scope-dropped proxy (D52) #3086
Two shapes, both on main 9cdbef1 (and the new seed), found when the seed-bound ceremony sweep removed the deliberate .clone() in build_cache_current_compiler_fingerprint ("returning the cached owner would empty the cache") and four build-store fixtures failed:
var ready: i32 = 0
var g: str = ""
fn fp_ret() -> str:
if g.len() > 100: return ""
return g # _0 = move _1; _1 = const zst → the global is blanked
fn fp3() -> str:
if ready == 0:
g = f"abc{1}" # proxy _3 bound in the if's scope, drop(_3) at its exit
ready = 1
g # a second proxy _9 is made and moved: _0 = move _9
fn main:
g = f"abc{1}"
print(f"[{fp_ret()}] [{fp_ret()}]") # [abc1] []
print(f"[{fp3()}] [{fp3()}] {g.len()}")
The block-tail form fn fp() -> str: g is right (_0 = copy+retain _1). --dump-mir shows the two defects: tail_local_moves_out (the return path's last-use rule) turns the copy of the proxy into a move without checking local_is_global (D52 §9.1c: a global is never moved out); and ensure_global_local binds the proxy in the current block scope, so a global first touched inside an if is dropped at that block's exit and re-proxied afterwards. --validate-all and with analyze … audit:all were silent on both, so the ownership validator gains the check (a move whose place is rooted in a global local).
Fixtures: behav_<this>_global_str_return_copies.w and the build-store fixtures that found it.
Fixed on seed-bound-sweep (PR #3082, stack #3085): tail_local_moves_out keeps a global's copy (the local_is_global check its block-tail twin had), ensure_global_local remembers the proxy for the whole body so a block never re-proxies or drops it, and the ownership validator refuses a move rooted in a global local (validate_global_moves). Both repros print the global intact under the debug allocator; fixture behav_3086_global_str_return_copies.
Does not reproduce on main: the issue's program prints [abc1] [abc1] and [abc1] [abc1] 4. Pinned as test/behavior/behav_3086_global_str_return_copies.w (Merged to main ae20d89, #3248).
Activity
ehartford commentedon Nov 8, 2026
Fixed on
seed-bound-sweep(PR #3082, stack #3085):tail_local_moves_outkeeps a global's copy (thelocal_is_globalcheck its block-tail twin had),ensure_global_localremembers the proxy for the whole body so a block never re-proxies or drops it, and the ownership validator refuses amoverooted in a global local (validate_global_moves). Both repros print the global intact under the debug allocator; fixturebehav_3086_global_str_return_copies.#3086 (D52): a global is never moved out — the return path copies it,…
#3086 (D52): a global is never moved out — the return path copies it,…
The seed-bound ceremony rewrites, now that the seed is past D197 and …
Issues batch A: #1021 #1022 #1023 #2760 #3057 #3060 #3086 #3113 #3114 (…
ehartford commentedon Nov 11, 2026
Does not reproduce on main: the issue's program prints
[abc1] [abc1]and[abc1] [abc1] 4. Pinned as test/behavior/behav_3086_global_str_return_copies.w (Merged to main ae20d89, #3248).