authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-07-31 02:32:32+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-07-31 02:32:32+01:00
log032bbd68a7a17b4f8167f9644430c375f43da60c
treebb457848c0dfcad4dbc7f55d05172a9e31973007
parentde23ccfad1630e30d5b5ea1278ab2f375f987568
parent2dea904d5a1602674d9cd147f8a5f2797dd00c40
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #24537 from IOKG04/some-documentation-updates-0

some small langref changes

3 files changed, 13 insertions(+), 4 deletions(-)

doc/langref.html.in+4-4
......@@ -3215,7 +3215,7 @@ fn createFoo(param: i32) !Foo {
32153215 to increase their development pace.
32163216 </p>
32173217 <p>
3218 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.
3218 Error Return Traces are enabled by default in {#link|Debug#} builds and disabled by default in {#link|ReleaseFast#}, {#link|ReleaseSafe#} and {#link|ReleaseSmall#} builds.
32193219 </p>
32203220 <p>
32213221 There are a few ways to activate this error return tracing feature:
......@@ -4840,7 +4840,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
48404840 <p>
48414841 This builtin can be called from a {#link|comptime#} block to conditionally export symbols.
48424842 When <code>ptr</code> points to a function with the C calling convention and
4843 {#syntax#}options.linkage{#endsyntax#} is {#syntax#}.Strong{#endsyntax#}, this is equivalent to
4843 {#syntax#}options.linkage{#endsyntax#} is {#syntax#}.strong{#endsyntax#}, this is equivalent to
48444844 the {#syntax#}export{#endsyntax#} keyword used on a function:
48454845 </p>
48464846 {#code|export_builtin.zig#}
......@@ -5179,7 +5179,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
51795179 <pre>{#syntax#}@mod(numerator: T, denominator: T) T{#endsyntax#}</pre>
51805180 <p>
51815181 Modulus division. For unsigned integers this is the same as
5182 {#syntax#}numerator % denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator > 0{#endsyntax#}, otherwise the
5182 {#syntax#}numerator % denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#}, otherwise the
51835183 operation will result in a {#link|Remainder Division by Zero#} when runtime safety checks are enabled.
51845184 </p>
51855185 <ul>
......@@ -5284,7 +5284,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
52845284 <pre>{#syntax#}@rem(numerator: T, denominator: T) T{#endsyntax#}</pre>
52855285 <p>
52865286 Remainder division. For unsigned integers this is the same as
5287 {#syntax#}numerator % denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator > 0{#endsyntax#}, otherwise the
5287 {#syntax#}numerator % denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#}, otherwise the
52885288 operation will result in a {#link|Remainder Division by Zero#} when runtime safety checks are enabled.
52895289 </p>
52905290 <ul>
doc/langref/test_coerce_slices_arrays_and_pointers.zig+7
......@@ -67,4 +67,11 @@ test "*T to *[1]T" {
6767 try expect(z[0] == 1234);
6868}
6969
70// Sentinel-terminated slices can be coerced into sentinel-terminated pointers
71test "[:x]T to [*:x]T" {
72 const buf: [:0]const u8 = "hello";
73 const buf2: [*:0]const u8 = buf;
74 try expect(buf2[4] == 'o');
75}
76
7077// test
test/behavior/math.zig+2
......@@ -525,6 +525,8 @@ fn testIntDivision() !void {
525525 try expect(rem(i32, 10, 12) == 10);
526526 try expect(rem(i32, -14, 12) == -2);
527527 try expect(rem(i32, -2, 12) == -2);
528 try expect(rem(i32, 118, -12) == 10);
529 try expect(rem(i32, -14, -12) == -2);
528530 try expect(rem(i16, -118, 12) == -10);
529531
530532 try expect(divTrunc(i20, 20, -5) == -4);