Skip to content

Commit 032bbd6

Browse files
authored
Merge pull request #24537 from IOKG04/some-documentation-updates-0
some small langref changes
2 parents de23ccf + 2dea904 commit 032bbd6

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

doc/langref.html.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
71+
test "[: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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

0 commit comments

Comments
 (0)