szn

Bug 342 — std.ArrayList.toOwnedSlice() is removed in Zig 0.16

342. toOwnedSlice — FALSE POSITIVE

Files: N/A Severity: HIGH (downgraded) Status: ❌ FALSE POSITIVE

Verification: Standalone test confirming toOwnedSlice works:

test "toOwnedSlice still works" {
    var list: std.ArrayList(u8) = .empty;
    errdefer list.deinit(testing.allocator);
    try list.appendSlice(testing.allocator, "hello");
    const owned = try list.toOwnedSlice(testing.allocator);
    defer testing.allocator.free(owned);
    try testing.expectEqualStrings("hello", owned);
}

Result: passes, zero deprecation warnings.

Evidence from std lib source (array_list.zig):

Root cause of false positive: The Zig 0.16 skill doc stated std.json.stringify was removed (correct — replaced by std.json.fmt), and incorrectly extended that pattern to toOwnedSlice. The two are unrelated: stringify was truly removed, but toOwnedSlice remains.

No code changes needed.