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
fix: implement deallocation for fixed-length lists with heap elements
Fixed three bugs in the handling of FixedLengthList types:
1. `deallocate` in abi.rs was `todo!()`, causing a panic when flat
deallocation was needed (e.g. `list<own<resource>, 3>`). Now uses
`flat_for_each_record_type` to iterate element types.
2. `deallocate_indirect` in abi.rs was a silent no-op `=> {}`, leaking
heap-allocated elements (e.g. strings in `list<string, 3>`). Now
iterates each element's memory offset and deallocates using
`deallocate_indirect_fields`.
3. `FixedLengthListLower` in the Rust code generator used array
indexing (`a[0]`, `a[1]`, ...) to extract elements, which fails for
non-Copy types like String. Changed to use array destructuring
(`let [e0, e1, ...] = a;`) to properly move elements out.
Added runtime tests with `list<string, 3>` functions (param, result,
roundtrip) and allocation tracking via Guard pattern to verify no
memory leaks when passing/returning fixed-length lists of strings.
0 commit comments