(module loop_str_recur_literal_no_leak_pin ; mir.4 (#49 soundness, recur-arg leg): a Str loop binder whose ; `recur` rebinds it to a fresh static LITERAL each iteration. Without ; recur-arg Heap promotion the literal "reset" would be stored static ; into the binder alloca and dec'd on the next supersede — UB on a ; header-less static. lower_to_mir flips both the seed "x" and the ; recur literal "reset" to StrRep::Heap, so codegen str_clones each ; into an owned heap slab; every supersede dec then frees a real slab. ; Trace: seed slab1("x"); recur0 slab2("reset") decs slab1; recur1 ; slab3 decs slab2; recur2 slab4 decs slab3; exit acc=slab4, print ; consumes/frees it. allocs=4 frees=4 live=0. Expected stdout: reset. (fn main (type (fn-type (params) (ret (own (con Unit))) (effects IO))) (params) (body (let s (loop (acc (con Str) "x") (i (con Int) 0) (if (app ge i 3) acc (recur "reset" (app + i 1)))) (app print s)))))