; Iter 18g.tidy.fu2 RED-test fixture 1/3: dynamic-tag partial-drop ; carve-out at fn-return (Iter B / lib.rs:1093). ; ; Shape: ; - `Pair` carries two `Cell` fields (both pointer-typed). ; - `Cell` carries two `Wrap` fields (both pointer-typed). ; - `use_first` takes `(own Pair)` and pattern-binds the first ; slot only, wildcarding the second. ; - The bound slot's `Cell` is dec'd via `drop__Cell` at the ; outer arm-close (moves[a] empty → field_drop_call routes ; correctly). ; - At fn return, `p`'s `consume_count == 0`, mode = Own, and ; `moved_slots[p] = {0}`. Iter B's drop (lib.rs:1093) hits the ; dynamic-tag carve-out: moves non-empty → shallow ; `ailang_rc_dec(p)`. p's outer cell is freed; slot 1 (the ; wildcarded second Cell + its two MkWrap children = 3 cells) ; leaks. ; ; Pre-fix: live = 3 (one Cell + two MkWrap children). ; Post-fix: live = 0. ; ; This fixture is the cleanest of the three because no inner match ; is involved: the leak surfaces from Iter B alone. (module rc_own_param_partial_drop_leak (data Wrap (ctor MkWrap (con Int))) (data Cell (ctor MkCell (con Wrap) (con Wrap))) (data Pair (ctor MkPair (con Cell) (con Cell))) (fn build_pair (type (fn-type (params (con Int)) (ret (own (con Pair))))) (params n) (body (term-ctor Pair MkPair (term-ctor Cell MkCell (term-ctor Wrap MkWrap n) (term-ctor Wrap MkWrap 2)) (term-ctor Cell MkCell (term-ctor Wrap MkWrap 3) (term-ctor Wrap MkWrap 4))))) (fn use_first (type (fn-type (params (own (con Pair))) (ret (con Int)))) (params p) (body (match p (case (pat-ctor MkPair a _) 1)))) (fn main (type (fn-type (params) (ret (con Unit)) (effects IO))) (params) (body (do io/print_int (app use_first (app build_pair 1))))))