Summary
A boxed closure that WRITES a module-level export let fails to compile on the GBA target: the generated closure body emits *name.borrow_mut() = ... without the cell in scope → E0425.
error[E0425]: cannot find value `deadCol` in this scope
--> src/main.rs:13691:437
| ... *deadCol.borrow_mut() = _v.clone(); _v };
Repro (minimal shape)
export let deadCol: i32 = -1
function makeCast() {
function noteDeath(c: i32) { deadCol = c } // write to outer exported let
return { noteDeath: noteDeath }
}
let mk = [makeCast]
const M = mk[0]()
export function noteDeath(c: i32) { return M.noteDeath(c) }
Reads of the outer exported let capture fine; the WRITE path doesn't capture the VmRef cell into the closure. This blocks the factory-wrapping pattern that is currently the only game-side mitigation for the run()-frame stack ceiling (see the companion frame-size issue) on any module whose functions mutate their exported state — which is most of them.
Ask
Capture the module cell (<name>_cell) into boxed closures for assignments the same way reads are captured.
Summary
A boxed closure that WRITES a module-level
export letfails to compile on the GBA target: the generated closure body emits*name.borrow_mut() = ...without the cell in scope → E0425.Repro (minimal shape)
Reads of the outer exported let capture fine; the WRITE path doesn't capture the
VmRefcell into the closure. This blocks the factory-wrapping pattern that is currently the only game-side mitigation for the run()-frame stack ceiling (see the companion frame-size issue) on any module whose functions mutate their exported state — which is most of them.Ask
Capture the module cell (
<name>_cell) into boxed closures for assignments the same way reads are captured.