Migrate project from zig 0.15.2 to 0.16 #29

Merged
maleszka merged 20 commits from refactor/zig-0.16 into main 2026-10-08 17:18:14 +02:00
Owner
No description provided.
minimum_zig_version was already bumped to 0.16.0; this was the one
remaining build.zig-local break before reaching src/-local errors.
Zig 0.16.0 removes @Type in favor of individual type-creating builtins
(see release notes). log.zig's scope-literal parameters become
@EnumLiteral(); relational.zig's Columnar() struct-of-arrays reification
moves to @Struct's struct-of-arrays calling convention.
std.debug.lockStdErr/unlockStdErr and std.Io.tty.Config.detect were
removed; the replacement lockStderr(buf) returns a locked handle whose
.terminal() gives the writer/color API directly, so there's no longer a
separate std.fs.File.stderr()/tty-detect/stderr_writer dance. Dropped the
trailing explicit flush() too, since lockStderr's writer already owns that.
0.16.0 split std.zon.parse.fromSlice into a non-allocating variant and
fromSliceAlloc, the sibling that actually owns an allocator param; every
call site here wants the latter.
0.16.0 removed refAllDeclsRecursive outright, leaving only the shallow
refAllDecls; without a recursive replacement most nested-module tests
silently stop being discovered and run. Added one in api/root.zig and
pointed every per-module `test { ... }` block that used to call the std
version at it (platform modules collapse onto api's root test since
their declarations are already reachable from there).
std.http.Client's connect error set dropped and renamed several variants
in 0.16.0 (DNS/socket errors got split out, a few merged into others), so
NetClient.fetch's error-mapping switch needed its arms updated to match.
Also: ArrayList's unmanaged struct no longer has field defaults compatible
with `= .{}`, so CookieJar.init needed `.empty` instead.
`catch |err| switch (err) { explicit_tag => ..., inline else => |e| return e }`
stopped narrowing the inline-else capture to exclude already-handled tags
under 0.16.0, breaking error-set inference at every such call site. Switched
the catch-all arms to plain `else` (or, where only a single variant could
still reach it, an explicit arm) so the resulting error sets stay exact.
0.16.0 removed std.AutoArrayHashMap entirely; Relation now keeps its own
allocator field and backs itself with the Unmanaged array_hash_map.Auto,
the same pattern the rest of the codebase's Unmanaged containers already
follow. Updates every call site that used to reach the allocator through
hashmap.allocator or pass it implicitly.
zeit 0.9.0 reworked zeit.instant() to take an explicit now/timezone source
instead of a .source tag, and zeit.local() to take an io: std.Io param
alongside the allocator. Threads io through datetime.now()/local() to match,
and drops the now-redundant `catch unreachable` around instant() since the
new signature can't fail the same way.
NetClient.init now takes an io: std.Io it stores on std.http.Client itself.
HierarchicalFileStore follows std.fs.Dir/std.fs.File's move onto
std.Io.Dir/std.Io.File across its entire surface (open/create/close/rename/
walk/the Lock helper), and its atomic-write path moves off std.posix.fsync
onto std.Io.File.sync and off std.crypto.random onto store.io.random(),
preserving the "caches never end up worse than before" guarantee.
PlatformAPI.init/fetchRootNode/fetchContestNodeAndSome, both platforms'
implementations, their WebSession.init (needed for genCsprngSeed, which
now draws its nanosecond seed from std.Io.Timestamp.now() instead of the
removed std.time.nanoTimestamp()), and the parse functions that call
datetime.now() all gain an io: std.Io parameter threaded down from the
caller.
Config.init/ConfigRaw.loadFromFile/finalize, updateSubmitConfigCreatingFile
and writeSampleConfig all move their filesystem calls onto std.Io.Dir/File
and gain an io: std.Io parameter; Account.getCredentials follows for
evalPassCmd. shell.zig's XDG lookups move off the removed
std.process.getEnvVarOwned onto an explicit std.process.Environ.Map (sourced
from init.environ_map), and its evalCmd/runHook process-running helpers move
from std.process.Child.{init,run} onto std.process.{run,spawn}, following
Child.Term's variant renames (.Exited -> .exited etc.) in the exit-status switch.
Fzf.zig drops Child.init/spawn/waitForSpawn/collectOutput (all removed) for
std.process.spawn plus a std.Io.File.MultiReader to drain stdout/stderr
concurrently, and its SpawnError handling collapses onto a catch-all `else`
now that the error set itself changed shape. BinProvider.zig's embedded-
binary write moves from atomicFile() (removed) onto Dir.createFileAtomic().
Both, plus every fzf.zig selection helper (selectAccount/Contest/CodeLang/
Color), thread an io: std.Io parameter down from their callers.
Session.init and MaybeDiskStore's init/openDiskStore gain an io: std.Io
param, threaded down to PlatformAPI.init and HierarchicalFileStore.init.
Wbij gains and stores an io: std.Io field, used for the http client, fzf
calls, graph fetches, datetime.now(), and the progress-locking dance that
moves from std.Progress.lock/unlockStdErr onto io.lockStderr/unlockStderr.
prompt/askMaybeStoreSampleConfig/askMaybeStoreSubmitConfig/Solution's file
loading all move their file I/O from std.fs.File/Dir onto std.Io.File/Dir
and gain an io parameter where they didn't already have access to one.
clap 0.12.0's parse() now requires a std.process.Args, which only comes
from init.minimal.args, so main() takes std.process.Init and sources its
allocator/io/environ_map/args from it instead of hand-rolling a
GeneralPurposeAllocator and reaching for ad-hoc std.fs/std.process calls.
0.16.0 adds these as the idiomatic "split on first match, get both halves"
replacement for manual indexOf+slice arithmetic. Left the two <table>..</table>
extraction loops alone since they need the opening tag retained, which cut
discards by design.
maleszka changed title from WIP: Migrate project from zig 0.15.2 to 0.16 to Migrate project from zig 0.15.2 to 0.16 2026-10-08 16:39:59 +02:00
Author
Owner

Most changes were rather mechanical, but I consider this 0.15.2->0.16.0 migration as a net positive.

Most changes were rather mechanical, but I consider this 0.15.2->0.16.0 migration as a net positive.
maleszka deleted branch refactor/zig-0.16 2026-10-08 17:18:15 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
maleszka/wbij!29
No description provided.