Commit Graph

37893 Commits

Author SHA1 Message Date
nektro 259e4cf9fd std.ArrayHashMap: this workaround is no longer necessary 2026-04-20 16:49:52 +02:00
Andrew Kelley 4e2147d14e Merge pull request 'Fix uefi (un)installMultipleProtocolInterfaces' (#31934) from mrosowski/zig:uefi-fix-install-multiple into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31934
Reviewed-by: linus <mail@linusgroh.de>
2026-04-20 07:05:35 +02:00
Andrew Kelley 6067a8b1a0 Merge pull request 'std.Io.Dir: fix incorrect return types in setFileOwner and setTimestampsNow' (#31940) from lukasl/zig:fix-dir-setfileowner-error-type into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31940
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-20 02:23:17 +02:00
Alex Kladov 76174e1bce fuzz: don't err if .zig-cache/tmp doesn't exist
If we have just created cache_dir_path, then there's no `tmp` dir
there, and

    cache_dir.createFile(io, "tmp/libfuzzer.log", .{ .truncate = false })

fails.

Tested via

    $ zig version
    0.16.0
    $ zig build --zig-lib-dir ~/p/zig/lib/ --fuzz
2026-04-20 01:20:52 +02:00
Pavel Verigo d840583458 remove AIR .bool_or/.bool_and 2026-04-19 21:49:51 +02:00
Andrew Kelley dea6914aaa bootstrap.c: fix zig2 version
This should have been part of the "start the release cycle" commit.
2026-04-19 11:25:59 -07:00
Andrew Kelley b0f6889d12 Merge pull request 'docs: langref: Clear up terminology used for top-level doc comments' (#31920) into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31920
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-19 10:38:24 -07:00
Andrew Kelley 571388a93d langref: use the word "namespace" instead of "container" 2026-04-19 10:38:01 -07:00
Sage Hane f0649e7709 langref: Clear up terminology used for top-level doc comments 2026-04-19 10:12:22 -07:00
Andrew Kelley 50f96d2ca1 std.Io.Dir: add type checking for those two functions 2026-04-19 10:08:23 -07:00
Lukas Lalinsky 52e06ce4f6 std.Io.Dir: fix incorrect return types in setFileOwner and setTimestampsNow
`setFileOwner` declared `SetOwnerError!void` but its vtable method
returns the wider `SetFileOwnerError!void` (adds `NameTooLong` and
`BadPathName`), so any call through the wrapper fails to compile.

`setTimestampsNow` dispatched to `io.vtable.fileSetTimestamps` with
`(Dir, []const u8, Dir.SetTimestampsOptions)`, but that vtable entry
takes `(File, File.SetTimestampsOptions)`. The intended target is
`dirSetTimestamps`, whose signature matches the call site.
2026-04-19 10:07:44 -07:00
Andrew Kelley 9b177a7d21 Merge pull request 'Rework StackFallbackAllocator' (#31841) into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31841
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-18 14:52:12 -07:00
Mason Remaley e2c3920fb1 Renames buffer first allocator in compiler and std 2026-04-18 14:51:49 -07:00
Mason Remaley 6d40d374d8 Merges together the two buffer first allocator implementations 2026-04-18 14:51:49 -07:00
Mason Remaley 8c96487bb9 Updates all uses of StackFallbackAllocator 2026-04-18 14:51:49 -07:00
Mason Remaley a4d8e9608e Reworks the stack fallback allocator
The previous approach had a few downsides:

1. You couldn't set the alignment of the internal buffer. Many callers in
   the standard library trying to use this for a small vec style
   optimization worked around this by setting the alignment for
   the struct itself, this ends up very verbose and also assumes a
   specific layout for the struct which isn't guaranteed.

2. It was generic over the size of the buffer. This type is used a lot in
   std with various sizes.

3. It has an awkward API where you had to call get which mutated the type
   unlike all other allocators, and then had a runtime check to make sure
   you didn't get this wrong.

The new approach resolves all of these issues by just taking the buf as
an argument.

This is particularly amenable to smallvec style optimizations: you can
just declare the buf as an array of the item you want to allocate to get
the exact minimum size.
2026-04-18 14:51:49 -07:00
jmcaine 73ecc6333f std: implement heap.StackFirstAllocator
second attempt
2026-04-18 14:51:25 -07:00
Andrew Kelley 0346aef2da Merge pull request 'limb64: make fixLastLimb endian aware' (#31910) from pavelverigo/zig:limb64-be-fixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31910
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-18 23:46:34 +02:00
Pavel Verigo 2c5f2d67c1 Revert "compiler-rt: disable some limb64 tests on some big-endian targets"
This reverts commit 9125e24909.
2026-04-18 18:47:29 +02:00
Pavel Verigo 70c4b2424b limb64: make fixLastLimb endian aware 2026-04-18 18:47:17 +02:00
Meghan Denny 9636d76b6d std.os.linux: getdents accepts a c_uint length (#31825)
https://github.com/torvalds/linux/blob/e774d5f1bc27a85f858bce7688509e866f8e8a4e/include/linux/syscalls.h#L1100-L1102
https://github.com/torvalds/linux/blob/e774d5f1bc27a85f858bce7688509e866f8e8a4e/include/linux/syscalls.h#L477-L479
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31825
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-committed-by: Meghan Denny <hello@nektro.net>
2026-04-18 07:34:32 +02:00
David Senoner 21914c7c01 ziglibc: migrate tee linux syscall (#31911)
Add the Linux syscall wrapper for `tee`.

Migrate the `tee` syscall from musl libc to zig libc.

langref: note `ssize_t` and `isize`  are ABI compatible

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31911
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: David Senoner <seda18@rolmail.net>
Co-committed-by: David Senoner <seda18@rolmail.net>
2026-04-18 07:30:43 +02:00
Josh Megnauth ff612334fa libzigc: dup2 and dup3
This commit adds `dup2` and `dup3` based on musl. Zig already has
wrappers for the syscalls, but musl's implementation checks for a rare,
temporary race condition with dup2/3 and `open`. Like musl, this
implementation adds a fallback for dup3 if the syscall isn't available.

Contributes to: #30978
2026-04-17 23:13:39 +02:00
Mikołaj Rosowski 7020c9e4a9 std.os.uefi: pass null terminator in (un)installMultipleProtocolInterfaces 2026-04-17 22:33:17 +02:00
Mikołaj Rosowski 0473ddb1a7 std.os.uefi: fix _(un)installMultipleProtocolInterface signatures 2026-04-17 22:33:17 +02:00
Mikołaj Rosowski a3a1dd1d91 std.os.uefi: use uefi callconv for _(un)installMultipleProtocolInterfaces 2026-04-17 22:33:17 +02:00
Mikołaj Rosowski 1d7c8108b1 std.os.uefi: fix comptime idx 2026-04-17 22:33:17 +02:00
Alex Rønne Petersen 6e987a1d04 Merge pull request 'libzigc: move all unit tests from lib/c/ to test/c/' (#31923) from alexrp/zig:libc-test-refactor into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31923
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-17 22:31:35 +02:00
Linus Groh b0ef8d3610 std.Io.Threaded: serenity does not have wait4 2026-04-17 21:32:22 +02:00
Sam Connelly fa684bf42f Make *24 and *48 extern-compatible for ez80 2026-04-17 20:32:17 +02:00
Justus Klausecker a43973b336 std.Io.Semaphore: add waitTimeout
Returns `error.Timeout` if provided timeout expires before a permit is available.
Also adds/reworks tests for all wait functions.
2026-04-17 19:19:02 +02:00
Andrew Kelley 21980c82f4 Merge pull request 'Implement Condition.waitTimeout' (#31278) from lukasl/zig:condition-timeout into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31278
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-17 19:02:38 +02:00
Alex Rønne Petersen 6612e7cdb2 libzigc: skip tests that are failing under various targets/conditions 2026-04-17 15:08:23 +02:00
Alex Rønne Petersen 7ea8f842bc libzigc: move all unit tests from lib/c/ to test/c/
Before:

* test-zigc: run libzigc unit tests (part of test-modules)
* test-libc: run libc-test cases

Now:

* test-libc: run libc API unit tests (part of test-modules)
* test-libc-nsz: run libc-test cases

libc API unit tests (previously referred to as libzigc unit tests) now run for
all supported targets, even those we don't provide libzigc for. The idea is that
this will help us catch bad assumptions in the unit tests, as well as bugs in
other libcs.

I considered this setup:

* test-c: run libc API unit tests (part of test-modules)
* test-libc-nsz: run libc-test cases
* test-libc: both of the above

However, I do not like it because it gives a false sense of security; the full
module and C ABI test suites are still liable to catch libzigc bugs that test-c
and test-libc-nsz might not. So contributors should just run the test steps
outlined in https://codeberg.org/ziglang/zig/issues/30978.

Co-authored-by: rpkak <rpkak@noreply.codeberg.org>
2026-04-17 12:10:37 +02:00
Alex Rønne Petersen 3e1e625814 test: handle -Dskip-libc correctly for module tests
For a test target with link_libc = null, we need to skip it if we would
implicitly link libc because the target requires it or because we don't yet have
a syscall layer for it.
2026-04-17 12:10:37 +02:00
Alex Rønne Petersen 5464392e11 std.os: add APIs to determine whether Zig std requires libc for a target
This is distinct from the question of whether the target formally considers libc
to be the only stable syscall interface; for example, FreeBSD and NetBSD have
stable syscalls, but we don't yet have syscall layers for them in std.os.
2026-04-17 12:07:57 +02:00
Alex Rønne Petersen adb1f3efc2 Merge pull request 'test: reinstate compiler-rt and zigc tests with different LLVM bug workarounds' (#31909) from alexrp/zig:reinstate-tests into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31909
2026-04-17 12:04:30 +02:00
Alex Rønne Petersen dcd9ddc7cf Merge pull request 'std.c: Two small fixes for serenity' (#31916) from linus/zig:serenity-fixes into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31916
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-04-17 12:01:38 +02:00
Linus Groh 8abb14141e std.c: Fix serenity's futex() declaration
Two mistakes I made when translating from the C header:

- The timeout and userspace_address2 pointers should be nullable.
- futex_wait() and futex_wake() are defined as static functions and
  therefore not available as exported symbols. They're just thin
  wrappers around futex() anyway so that's fine.
2026-04-16 23:48:05 +01:00
Linus Groh 92ec9fa3d0 std.c: Remove serenity's serenity_{open,readlink}() functions
See: https://github.com/SerenityOS/serenity/commit/e4c989e45f0d30b7049b3f1d001cf4a87104d277
2026-04-16 23:48:05 +01:00
Andrew Kelley c0763b5e25 std.Io.Condition: separate wait impls for clarity
also:
* add docs
* add test coverage for waitUncancelable
* explicit error set declaration WaitTimeoutError
2026-04-16 14:52:48 -07:00
Andrew Kelley 078185a54b std.Io: still run Condition test on single-threaded
this will still work under Evented for example
2026-04-16 13:59:40 -07:00
Lukas Lalinsky d821446cf9 Implement Condition.waitTimeout
I'd have preferred if `vtable.futexWait` returned `error.Timeout`, since
all the OS-level APIs provide it. However, if I keep the vtable untouched,
I had to determine the timeout case by post-checking the deadline.
It's fine functionally, but one extra syscall that be avoided at
cost of changing the vtable and all the futex implementations.
2026-04-16 13:37:23 -07:00
Andrew Kelley a8226cd536 Merge pull request 'Haiku fixes' (#31851) from ypsvlq/zig:master into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31851
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-16 22:18:58 +02:00
xeondev 2b48f559f4 std.Io: move netRead to become an Operation 2026-04-16 22:13:29 +02:00
Andrew Kelley bea4ea5ff8 Merge pull request 'zigc: long double: call double function if long double and double are equivalent' (#31775) from rpkak/zig:zigc-long-double into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31775
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-16 19:57:54 +02:00
glowsquid 0177cb57c0 std.http.Client: make mutexes cancelable (#31880)
Makes most of the mutexes cancelable with the exception of the ones in deinit functions. I also fixed the compilation errors with `ConnectionPool.resize`.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31880
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
Co-authored-by: glowsquid <sachabarsayuracko@gmail.com>
Co-committed-by: glowsquid <sachabarsayuracko@gmail.com>
2026-04-16 19:47:46 +02:00
Richard Levitte ffcfeb919f Fix std.fmt.hex() to work with unsigned ints of all multiples of 8 bits
@SizeOf(@typeInfo(T)) for any u{n} seems to give sizes of u32, u64, u128
and so on, depending on what size x fits into.  This causes problems with
'>>' if x isn't exactly one of those sizes.

@typeInfo(@TypeOf(x)).int.bits gives a more accurate size.
2026-04-16 19:44:40 +02:00
Andrew Kelley 29532177c1 CI: add coverage for fuzzer compiling
From mlugg: this commit originally also added the same coverage to the
aarch64-linux-release script, but that caused the aarch64-linux-release
job to time out, so that change has been omitted for now.
2026-04-16 19:42:23 +02:00
zacoons ebc8fe4899 std.sort: clarify description of equalRange 2026-04-16 19:42:00 +02:00