Zig 0.16.0 released

What’s new:

  • switch improvements: packed struct and packed union can now be used as switch prong items, compared solely via their backing integer. Decl literals and @enumFromInt may now also appear as switch prong items, and union tag captures are now allowed for all prongs, not just inline ones.
  • @cImport deprecated: C translation is moving to the build system. The @cImport builtin is now deprecated; the recommended path is to use b.addTranslateC(...) in build.zig with a header file, or use the official translate-c package for more customization.
  • @Type replaced with individual builtins: The @Type builtin has been removed and replaced with 8 dedicated type-creating builtins: @EnumLiteral, @Int, @Tuple, @Pointer, @Fn, @Struct, @Union, and @Enum. For example, @Type(.{ .int = .{ .signedness = .unsigned, .bits = 10 } }) is now simply @Int(.unsigned, 10).
  • I/O as an Interface: The headline stdlib change. This debut makes I/O abstracted through an interface, enabling Future, Group, Batch, and Cancelation primitives, along with reworked File System, Networking, Process, Time, Entropy, and Sync Primitives. GenericReader, AnyReader, and FixedBufferStream are removed in favor of this model.
  • heap.ArenaAllocator is now thread-safe and lock-free. heap.ThreadSafeAllocator is removed since it’s no longer necessary.
  • Deflate compression added: alongside simplified decompression APIs, with a zlib performance comparison provided in the notes.
  • “Juicy Main”: a new pattern for the main function that takes an io argument, enabling more flexible I/O abstraction at the program entry point.
  • Containers migrated to “Unmanaged” style. Thread.Pool removed. PriorityDequeue added.
  • mem changes: new cut functions added, and indexOf-style functions renamed to find.
  • Windows improvements: networking without ws2_32.dll, completed migration to NtDll, and inter-process progress reporting.
  • Crypto additions: AES-SIV, AES-GCM-SIV, Ascon-AEAD, Ascon-Hash, Ascon-CHash.
  • Environment variables and process args are no longer global state.
  • Local package overrides: you can now override dependencies with local paths, useful during development.
  • Project-local package fetching: packages can be fetched into the project directory rather than a global cache.
  • Unit test timeouts, new --error-style and --multiline-errors flags, and a Temporary Files API.
  • Incremental compilation continues to advance. x86, aarch64, and WebAssembly backends all received improvements. Import libraries can now be generated from .def files without LLVM. C translation was also improved.
  • New ELF linker: a rewritten ELF linker replaces the old one.
  • Smith: an AST-based structure-aware fuzzer. It helped find and fix numerous compiler bugs. Multiprocess fuzzing, infinite fuzzing mode, and crash dumps were also added.
  • LLVM 21 (with loop vectorization temporarily disabled due to a regression). Updated bundled libraries: musl 1.2.5, glibc 2.43, Linux 6.19 headers, macOS 26.4 headers, FreeBSD 15.0 libc.
  • Solaris, AIX, and z/OS support dropped: the Zig project cannot support proprietary OSes that make it unreasonably difficult to obtain system headers. illumos remains supported as an open-source OpenSolaris fork.
  • Other language changes include small integer > float coercion, forbidding runtime vector indexes, forbidding trivial local addresses being returned from functions, pointers to comptime-only types no longer being comptime-only, and tighter rules on packed unions (no unused bits, no pointers inside).

 

AdP

Archived: Zig