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
Sema: a closure does not capture a local used only inside an unsafe block — () => unsafe { *p = 42 } stores through the return slot and segfaults (§12.4) #1598
Found while implementing the §12.4 by-place ruling in stack #1585; same class as #1570 (.Some(n)).
check_closure collects captures with expr_uses_symbol(body, sym), and that walk does not descend into an NK_UNSAFE_BLOCK (either unsafe { ... } or unsafe: block form). A local used only inside it is not captured, the closure has no local for it, and MirLower lowers the use to _0 — the closure's return local:
LLVM: %2 = load ptr, ptr %1 (the i32 return slot read as a pointer), store i32 42, ptr %2 → SIGSEGV. Reproduces on the pinned seed (nightly-20260922), the installed v0.15.2.1 and a stage1 of origin/main 02301f8:
Fixed on main by #1701 (3d5dc47): capture-set completeness, stored-view refusal, calls through &fn; battery green and pinned by the tests named in the PR.
Activity
Sema/Codegen: every capture of a non-move closure is by place, Copy o…
Sema/Codegen: every capture of a non-move closure is by place, Copy o…
Sema/Codegen: every capture of a non-move closure is by place, Copy o…
Sema/Codegen: every capture of a non-move closure is by place, Copy o…
Closures: every capture is found, a stored view is refused, a call th…
ehartford commentedon Sep 26, 2026
Fixed on main by #1701 (3d5dc47): capture-set completeness, stored-view refusal, calls through
&fn; battery green and pinned by the tests named in the PR.Sema: a type in expression position names no value — transmute[T](x) …
Modeled-C Amendment 2 (D76): callback argv/user data without unsafe (#…