ReviewOS

zig-utils/zig-js

Build: initialize test ArrayLists with pointer-stability metadata

#1020
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Problem

The current Zig 0.17 toolchain adds pointer_stability to std.ArrayListUnmanaged. Several test-only fixtures in src/interpreter.zig and src/promise.zig still construct lists by naming only items and capacity, so zig build test fails at compile time before any selected test runs.

Scope

  • Replace externally backed test-list literals with the standard constructors that initialize all current metadata.
  • Preserve whether each buffer is externally managed (initBuffer) or transferred to the list (fromOwnedSlice).
  • Audit the remaining raw { items, capacity } literals so custom stack types are not changed accidentally.

Acceptance

  • The focused unit artifact compiles with Zig 0.17.0-dev.2163.
  • The touched promise/microtask and waiter tests retain their exact behavior.
  • Production code and test262 behavior are unchanged.
9 days ago

Fixed on main in 700736c. Borrowed stack/fixed buffers now use ArrayListUnmanaged.initBuffer; heap backing transferred to the list uses fromOwnedSlice, preserving the previous ownership and logical lengths while initializing Zig 0.17 pointer-stability metadata.

Verification on the real-GC checkout:

  • JSON stringify: 15/15, 0 failed, 0 leaked
  • microtask: 18/18, 0 failed, 0 leaked
  • waitAsync: 16/16, 0 failed, 0 leaked
  • settlement: 7/7, 0 failed, 0 leaked
  • exact Promise job await preparation OOM: 1/1, 0 failed, 0 leaked

Test-only change; flips 0 test262 cases.

Sign in to comment on this issue.