(module loop_str_static_exit_no_leak_pin
  ; mir.4 (loop-result leg, soundness witness): a loop that RETURNS a
  ; static Str LITERAL from its exit arm. The result flows to the outer
  ; let-binder `s`, freed at scope-close via codegen's loop-result drop
  ; path. Before mir.4 that path excluded Str (the !is_str carve-out at
  ; drop.rs); deleting the carve-out without promoting the exit literal
  ; would `ailang_rc_dec` a header-less static — SIGSEGV. lower_to_mir
  ; promotes the tail literal "result" to StrRep::Heap so codegen
  ; str_clones it into an owned heap slab; scope-close then frees it.
  ; Single Int binder (no Str binder to leak). allocs=1 frees=1 live=0.
  ; Expected stdout: result.
  (fn main (type (fn-type (params) (ret (own (con Unit))) (effects IO))) (params)
    (body
      (let s
        (loop (i (con Int) 0)
          (if (app ge i 1)
              "result"
              (recur (app + i 1))))
        (app print s)))))
