chore: upgrade Zig 0.15 → 0.16#89
Merged
Merged
Conversation
Migrate the entire codebase to Zig 0.16.0. Key changes:
- std.Thread.Futex removed → custom NativeFutex using OS syscalls (__ulock on macOS, futex(2) on Linux)
- std.time.Timer removed → MonotonicTimer using clock_gettime(MONOTONIC)
- std.time.nanoTimestamp removed → clock_gettime-based replacement
- std.fs.cwd() → std.Io.Dir.cwd() with io parameter threading
- File operations (openFile, createFile, close, stat, writeAll, readAll) now require io parameter
- std.heap.GeneralPurposeAllocator removed → main() accepts std.process.Init
- std.posix.getenv removed → std.c.getenv
- std.fmt.FormatOptions → std.fmt.Options
- std.fmt.format(writer, ...) → writer.print(...)
- std.io.fixedBufferStream removed → SliceReader utility + std.Io.Writer.fixed
- ArrayListUnmanaged .{} init → .empty (Zig 0.16 requires explicit fields)
- ArrayListUnmanaged .writer(allocator) → std.Io.Writer.Allocating pattern
- reader.readNoEof → reader.readSliceAll
- Build.Step.Compile.addLibraryPath → root_module.addLibraryPath
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace std.c.clock_gettime and std.c.getenv (which require libc) with Zig-native alternatives that work on Linux without libc: - Timer: use std.Io.Timestamp.now(io, .boot) via global_single_threaded - Getenv: scan process environ block from Threaded global (no libc) This fixes CI failures on Linux where libc is not linked by default. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace ad-hoc workarounds from the 0.15→0.16 migration with proper std.Io usage: - Consolidate 6 duplicate MonotonicTimer copies into a single io-accepting definition in zolt-pool/timer.zig - Replace custom SliceReader with std.Io.Reader.fixed(); use concrete *std.Io.Writer / *std.Io.Reader in serialization signatures - Thread io: std.Io from main(init) through prove/verify/run commands, ELFLoader, and DoryCommitmentScheme SRS functions - Replace 70-line NativeFutex (raw __ulock/futex syscalls) with std.Io.futexWake / futexWaitUncancelable / futexWaitTimeout - Remove duplicate nativeGetenv from jolt_device.zig Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use Io.Limit's .limited(n) constructor and ArrayListUnmanaged's .empty initializer to match the rest of the 0.16 migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
std.Iointerface, stdlib renames, and language changesKey migrations
std.Thread.FutexNativeFutex(OS syscalls)std.time.TimerMonotonicTimer(clock_gettime)std.fs.cwd().openFile(path, .{})std.Io.Dir.cwd().openFile(io, path, .{})std.heap.GeneralPurposeAllocatorstd.process.Init(main receives allocator)std.posix.getenv()std.c.getenv()std.fmt.FormatOptionsstd.fmt.OptionsArrayListUnmanaged(T){}ArrayListUnmanaged(T).emptybuf.writer(allocator)std.Io.Writer.Allocatingpatternfile.writeAll(data)file.writeStreamingAll(io, data)reader.readNoEof(buf)reader.readSliceAll(buf)/SliceReaderAdded utilities
MonotonicTimerindebug.zig— cross-platform monotonic timer usingclock_gettimeNativeFutexinthread_pool.zig— direct OS futex calls (macOS__ulock/ Linuxfutex(2))SliceReaderinutils/mod.zig— byte-slice reader withreadInt/readByte/readAllfor deserialization codeTest plan
zig buildcompiles cleanly (all targets)zig build testpasses (all unit tests)zig build fmtclean🤖 Generated with Claude Code