From 3c046ab9d94c96632bdfd21ad20bea0613bfc1e2 Mon Sep 17 00:00:00 2001 From: IOKG04 Date: Tue, 22 Jul 2025 12:23:16 +0200 Subject: [PATCH 1/4] `[:x]T` coerces into `[*:x]T` https://github.com/ziglang/zig/issues/9628 --- doc/langref/test_coerce_slices_arrays_and_pointers.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/langref/test_coerce_slices_arrays_and_pointers.zig b/doc/langref/test_coerce_slices_arrays_and_pointers.zig index b2fdb6c787..67b2687163 100644 --- a/doc/langref/test_coerce_slices_arrays_and_pointers.zig +++ b/doc/langref/test_coerce_slices_arrays_and_pointers.zig @@ -67,4 +67,11 @@ test "*T to *[1]T" { try expect(z[0] == 1234); } +// Sentinel-terminated slices can be coerced into sentinel-terminated pointers +test "[:x]T to [*:x]T" { + const buf: [:0]const u8 = "hello"; + const buf2: [*:0]const u8 = buf; + try expect(buf2[4] == 'o'); +} + // test From a91b4aab734ec17273ca8ea5e4a8afabd6193107 Mon Sep 17 00:00:00 2001 From: IOKG04 Date: Tue, 22 Jul 2025 12:32:45 +0200 Subject: [PATCH 2/4] error return traces are *not* enabled for ReleaseSafe https://github.com/ziglang/zig/issues/24232 --- doc/langref.html.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index e8189e5c42..348f35444d 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -3215,7 +3215,7 @@ fn createFoo(param: i32) !Foo { to increase their development pace.

- Error Return Traces are enabled by default in {#link|Debug#} and {#link|ReleaseSafe#} builds and disabled by default in {#link|ReleaseFast#} and {#link|ReleaseSmall#} builds. + Error Return Traces are enabled by default in {#link|Debug#} builds and disabled by default in {#link|ReleaseFast#}, {#link|ReleaseSafe#} and {#link|ReleaseSmall#} builds.

There are a few ways to activate this error return tracing feature: From 84ae54fbe64a15301317716e7f901d81585332d5 Mon Sep 17 00:00:00 2001 From: IOKG04 Date: Tue, 22 Jul 2025 13:15:43 +0200 Subject: [PATCH 3/4] `@rem()` and `@mod()` take `denominator != 0`, not just `denominator > 0` https://github.com/ziglang/zig/issues/23635 I also added tests for `@rem()` with `denominator < 0` cause there were none before I hope I added them in the correct place, if not I can change it ofc --- doc/langref.html.in | 4 ++-- test/behavior/math.zig | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 348f35444d..139c19211e 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -5179,7 +5179,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val

{#syntax#}@mod(numerator: T, denominator: T) T{#endsyntax#}

Modulus division. For unsigned integers this is the same as - {#syntax#}numerator % denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator > 0{#endsyntax#}, otherwise the + {#syntax#}numerator % denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#}, otherwise the operation will result in a {#link|Remainder Division by Zero#} when runtime safety checks are enabled.