38065 Commits

Author SHA1 Message Date
mlugg 7eb79daffb Merge pull request 'std.builtin -> std.lang migration progress' (#32182) from compiler-std-lang into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32182
2026-05-06 10:10:44 +02:00
Andrew Kelley ebff436985 langref: fix incorrect description of >> operation 2026-05-05 14:39:50 -07:00
Andrew Kelley 56265d6f99 std.Io: clarify Group semantics with respect to async tasks 2026-05-05 13:39:24 -07:00
Alex Rønne Petersen 3fafbd2e35 Merge pull request 'std: fix getCpuCount() for emscripten' (#35206) from jeffkdev/zig:fix-issue-31871 into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35206
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-05-05 17:20:14 +02:00
johan0A 6a37df00ec Config.resolve: don't error on explicit dynamic linker for Lib/Obj outputs 2026-05-05 17:17:15 +02:00
jeffkdev 4402a7477a Add emscripten_num_logical_cores() 2026-05-05 08:14:03 -04:00
Linus Groh 0add2dfc41 std.Io.File: Remove deprecated option types 2026-05-05 04:12:52 +02:00
Sawyer X 32ea57af50 Add stat for darwin aarch64 (#32178)
This fixes #32176.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32178
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-05-05 03:56:45 +02:00
jeffkdev 0cdc2fa5fb fix getCpuCount() for emscripten 2026-05-04 16:56:48 -04:00
Pavel Verigo 3d1fb4fac8 stage2-wasm: disable std tests, add failing behavior tests 2026-05-04 07:40:02 +02:00
linus a794287573 Merge pull request 'std.zig.LibCInstallation: Add support for serenity' (#32172) from linus/zig:more-serenity into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32172
Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>
2026-05-03 21:04:54 +02:00
Matthew Lugg e393962bc2 langref: use 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:30 +01:00
Matthew Lugg 4c330e053b compiler: use 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:30 +01:00
Matthew Lugg e133f793ee compiler: depend on 'std.lang' instead of 'std.builtin' 2026-05-03 12:23:29 +01:00
Matthew Lugg 8df04e1444 std: actually rename std.builtin to std.lang
This is now the canonical name, and `std.builtin` is a deprecated alias.
2026-05-03 12:22:37 +01:00
Prokop Randáček 02097dff70 setKey shouldn't recompute the entire index
setKey used to just call rebuildIndex which allocates a new index and
inserts into it all entries. This is the only allocation that setKey
needed to do.

Instead I propose that setKey sets the key in the entries and then does
a remove of the old key from the index and insert of the new key into
the index. This eliminates the need for setKey to allocate and makes
it infallible

To achieve this I extracted a helper function for inserting a single
entry into the index. Function for removing one entry from the index
already exists. setKey now just calls these two functions.
2026-05-02 20:15:10 +02:00
Andrew Kelley 04481c76cb Merge pull request 'Export wrapper around Zig DllMain function when linking libc + add tests' (#32179) from squeek502/zig:windows-dlls into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32179
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-02 20:06:56 +02:00
Justus Klausecker 1f22b2cbb2 LowerZon: fix packed containers
Since `packed` containers are now internally represented by a `bitpack`,
they need special handling on initialization: they need to be either
bitpacked or bitcasted to their backing integer. `Sema` already did this,
but `LowerZon` didn't yet.
2026-05-02 20:05:33 +02:00
Ryan Liptak a450016eb1 Add tests for DllMain to windows_entry_points standalone test 2026-05-02 02:44:26 -07:00
Ryan Liptak 8b16160b6f DllMain symbols: use ptrCast to allow using non-std pointer type
`HINSTANCE` is `*opaque {}` so using a type that should be compatible from alternate bindings (zigwin32, for example) would be a (false positive) compile error without this ptrCast.
2026-05-02 02:44:26 -07:00
Ryan Liptak 5aeeb6a0a4 Conditionally export wrapper around Zig-defined DllMain function when linking libc
This logic exists for other main functions, so it makes sense to do it for DllMain, too.
2026-05-02 02:44:26 -07:00
Andrew Kelley 0db721ec2e std: alias lang to builtin
see #19690
2026-05-02 11:29:27 +02:00
Linus Groh 0f5de17d6d std.zig.LibCInstallation: Add support for serenity
Largely mirrors Haiku, Serenity provides crt0 and GCC the rest (though
only crtbegin/crtend are used as per serenity's toolchain patches[1]):

```
$ find Build/aarch64/Root -iname 'crt*.o'
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtbeginS.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtend.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtbegin.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtfastmath.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crti.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtn.o
Build/aarch64/Root/usr/local/lib/gcc/aarch64-serenity/15.2.0/crtendS.o
Build/aarch64/Root/usr/lib/crt0.o
```

Serenity has a GCC and LLVM toolchain that work equally well, support
for the latter may be added in the future.

[1]: https://github.com/SerenityOS/serenity/blob/727c4a3d1a6748221b383207dac354e564b6150d/Toolchain/Patches/gcc/0001-Add-a-gcc-driver-for-SerenityOS.patch#L120-L127
2026-05-02 01:28:30 +01:00
Linus Groh 89b0c634c1 compiler: Enable PIE by default for serenity
See:
- https://github.com/SerenityOS/serenity/blob/727c4a3d1a6748221b383207dac354e564b6150d/Meta/CMake/serenity_compile_options.cmake#L15
- https://github.com/llvm/llvm-project/blob/62418bee5b9679c5b3bd536fb1101913b1c4e4d5/clang/lib/Driver/ToolChains/Serenity.h#L65
2026-05-02 01:28:22 +01:00
Saurabh Mishra d02d0b879c std:ArrayList: Merge getLastOrNull into getLast (#32008)
This PR merges the functionality of the `getLastOrNull` method into `getLast`, which improves consistency as its
based on methods like `front`, `back`, and `peek` in the `Deque` and `PriorityQueue` containers.

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32008
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-02 02:26:15 +02:00
pentuppup 845b6a8efe Zcu: remove optimizeMode(), fix usages 2026-05-01 10:39:43 +02:00
Andrew Kelley 95507faf13 llvm builder: add missing comma before predictable metadata 2026-05-01 06:31:38 +02:00
Meghan Denny 7c39558c7c std.MultiArrayList: add a swap method 2026-05-01 06:31:11 +02:00
squidy239 1e9bae83f1 remove deprecated managed MemoryPool versions (#31483)
`MemoryPoolOptions` becomes `memory_pool.Options`

`Managed`, `AlignedManaged`, and `ExtraManaged` removed

progresses #31220

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31483
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-05-01 05:27:45 +02:00
Alex Rønne Petersen f7a607ef68 Merge branch 'ci-jit-cmd' 2026-05-01 00:53:56 +02:00
Alex Rønne Petersen 8eafca4c9b test: compile all JIT'd commands as part of test-cli 2026-05-01 00:53:39 +02:00
Alex Rønne Petersen dfbea20d45 zig std: don't return an error exit code on --help 2026-05-01 00:53:39 +02:00
mlugg 5d55999d20 Merge pull request 'delete the bad features' (#32130) from rejected-for-language-simplicity into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32130
2026-04-30 20:43:17 +02:00
Matthew Lugg bb83883acd langref: update for language changes 2026-04-30 09:03:58 +01:00
Matthew Lugg c144003fca tests: fix libc test with -Dno-matrix 2026-04-30 09:03:58 +01:00
Matthew Lugg 72d954e7d3 compiler: remove array multiplication from the language
Resolves: https://github.com/ziglang/zig/issues/24738
2026-04-30 09:03:58 +01:00
Matthew Lugg fdac89d6cd remove uses of array multiplication
In preparation for its removal as accepted in
https://github.com/ziglang/zig/issues/24738.
2026-04-30 08:57:51 +01:00
Matthew Lugg 57634b7809 compiler: remove i0 from the language
Resolves: https://github.com/ziglang/zig/issues/1593
2026-04-30 08:57:51 +01:00
Matthew Lugg 213c4fc25f lib,test: remove uses of i0
In preparation for its removal, as accepted in
https://github.com/ziglang/zig/issues/1593.
2026-04-30 08:57:51 +01:00
Matthew Lugg d764716cb5 compiler: remove capturing errdefer from the language
Resolves: https://github.com/ziglang/zig/issues/23734
2026-04-30 08:57:50 +01:00
Matthew Lugg e67c344fc0 compiler,tests,tools: remove uses of capturing errdefer
In preparation for its removal, as accepted in
https://github.com/ziglang/zig/issues/23734.
2026-04-29 23:27:58 +01:00
Matthew Lugg 7b44e8986f Sema: remove void{} from the language
Because this syntax is not heavily used, and the migration can be done
with a simple text substitution, I do not believe a `zig fmt` fixup is
necessary for this change.

Resolves: https://github.com/ziglang/zig/issues/15213
2026-04-29 23:27:58 +01:00
Matthew Lugg 106850fd4c tests: remove uses of void{}
In preparation for this syntax to be removed from the language per
https://github.com/ziglang/zig/issues/15213.
2026-04-29 23:27:58 +01:00
Alex Rønne Petersen 2407ee954b Merge pull request 'implement .preinit_array support in link.Elf; link libtsan with -whole-archive' (#32107) from alexrp/zig:preinit-array into master
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/32107
Reviewed-by: mlugg <mlugg@noreply.codeberg.org>
2026-04-29 22:10:21 +02:00
Alex Rønne Petersen 0227253677 compiler: link libtsan with -whole-archive
libtsan contains a .preinit_array entry that must run for correctness.
2026-04-29 13:01:33 +02:00
Alex Rønne Petersen 3906434746 link.Elf: implement .preinit_array support 2026-04-28 16:42:06 +02:00
Matthew Lugg ce198b7c28 std.c: fix Haiku definition of MSF 2026-04-28 12:52:03 +01:00
Alex Rønne Petersen 89ed51bf53 link.Elf, link.Lld: executables should not have an image base on Haiku
Executables are always ET_DYN on Haiku, so like shared libraries, they should
not have an image base set. Elf2 already got this right, but Elf and Lld didn't.

closes https://codeberg.org/ziglang/zig/issues/32100
2026-04-28 09:56:53 +02:00
mihael 764760df62 libzigc/math: Implement rintl, lrintl (#31791)
It's a fairly straightforward port of `musl`'s `rintl`, like `rint` and `rintf` were. `libc-test` tests for `rintl` are uncommented since they're now passing.

I've also covered special cases for `rint` with tests, and broke down the current `rint` and `modf` test declarations into multiple -- so each libc function get its own test declaration at the very least.

Contributes to #30978

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31791
Reviewed-by: Andrew Kelley <andrew@ziglang.org>
2026-04-27 16:48:55 +02:00
GasInfinity 1deb029a66 std: rename bit_set variants and deprecate the managed one.
* aliases and deprecates the previous names.
* also update callsites to use the non-deprecated declarations.
2026-04-27 16:46:26 +02:00