Skip to content

Commit 8642770

Browse files
wooster0Vexu
authored andcommitted
langref: add missing return types to builtin functions
This should add all remaining missing return types to all builtin functions. For @clz, @ctz, and @popcount it uses anytype for the lack of a better alternative. We already use this return type for other builtin functions in the langref to indicate that the type is not always the same. It is not possible to use anytype as the return type for regular functions but builtin functions are special.
1 parent f9b5829 commit 8642770

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

doc/langref.html.in

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7814,7 +7814,7 @@ comptime {
78147814
{#header_close#}
78157815

78167816
{#header_open|@breakpoint#}
7817-
<pre>{#syntax#}@breakpoint(){#endsyntax#}</pre>
7817+
<pre>{#syntax#}@breakpoint() void{#endsyntax#}</pre>
78187818
<p>
78197819
This function inserts a platform-specific debug trap instruction which causes
78207820
debuggers to break there.
@@ -7933,7 +7933,7 @@ pub const CallModifier = enum {
79337933
{#header_close#}
79347934

79357935
{#header_open|@cDefine#}
7936-
<pre>{#syntax#}@cDefine(comptime name: []u8, value){#endsyntax#}</pre>
7936+
<pre>{#syntax#}@cDefine(comptime name: []u8, value) void{#endsyntax#}</pre>
79377937
<p>
79387938
This function can only occur inside {#syntax#}@cImport{#endsyntax#}.
79397939
</p>
@@ -7977,7 +7977,7 @@ pub const CallModifier = enum {
79777977
{#see_also|Import from C Header File|@cInclude|@cDefine|@cUndef#}
79787978
{#header_close#}
79797979
{#header_open|@cInclude#}
7980-
<pre>{#syntax#}@cInclude(comptime path: []u8){#endsyntax#}</pre>
7980+
<pre>{#syntax#}@cInclude(comptime path: []u8) void{#endsyntax#}</pre>
79817981
<p>
79827982
This function can only occur inside {#syntax#}@cImport{#endsyntax#}.
79837983
</p>
@@ -7989,7 +7989,7 @@ pub const CallModifier = enum {
79897989
{#header_close#}
79907990

79917991
{#header_open|@clz#}
7992-
<pre>{#syntax#}@clz(operand: anytype){#endsyntax#}</pre>
7992+
<pre>{#syntax#}@clz(operand: anytype) anytype{#endsyntax#}</pre>
79937993
<p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>
79947994
<p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
79957995
<p>
@@ -8068,7 +8068,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
80688068
{#header_close#}
80698069

80708070
{#header_open|@compileError#}
8071-
<pre>{#syntax#}@compileError(comptime msg: []u8){#endsyntax#}</pre>
8071+
<pre>{#syntax#}@compileError(comptime msg: []u8) noreturn{#endsyntax#}</pre>
80728072
<p>
80738073
This function, when semantically analyzed, causes a compile error with the
80748074
message {#syntax#}msg{#endsyntax#}.
@@ -8081,7 +8081,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
80818081
{#header_close#}
80828082

80838083
{#header_open|@compileLog#}
8084-
<pre>{#syntax#}@compileLog(args: ...){#endsyntax#}</pre>
8084+
<pre>{#syntax#}@compileLog(args: ...) void{#endsyntax#}</pre>
80858085
<p>
80868086
This function prints the arguments passed to it at compile-time.
80878087
</p>
@@ -8139,7 +8139,7 @@ test "main" {
81398139
{#header_close#}
81408140

81418141
{#header_open|@ctz#}
8142-
<pre>{#syntax#}@ctz(operand: anytype){#endsyntax#}</pre>
8142+
<pre>{#syntax#}@ctz(operand: anytype) anytype{#endsyntax#}</pre>
81438143
<p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type or an integer vector type.</p>
81448144
<p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
81458145
<p>
@@ -8159,7 +8159,7 @@ test "main" {
81598159
{#header_close#}
81608160

81618161
{#header_open|@cUndef#}
8162-
<pre>{#syntax#}@cUndef(comptime name: []u8){#endsyntax#}</pre>
8162+
<pre>{#syntax#}@cUndef(comptime name: []u8) void{#endsyntax#}</pre>
81638163
<p>
81648164
This function can only occur inside {#syntax#}@cImport{#endsyntax#}.
81658165
</p>
@@ -8370,7 +8370,7 @@ export fn @"A function name that is a complete sentence."() void {}
83708370
{#header_close#}
83718371

83728372
{#header_open|@fence#}
8373-
<pre>{#syntax#}@fence(order: AtomicOrder){#endsyntax#}</pre>
8373+
<pre>{#syntax#}@fence(order: AtomicOrder) void{#endsyntax#}</pre>
83748374
<p>
83758375
The {#syntax#}fence{#endsyntax#} function is used to introduce happens-before edges between operations.
83768376
</p>
@@ -8622,7 +8622,7 @@ test "integer cast panic" {
86228622
{#header_close#}
86238623

86248624
{#header_open|@memcpy#}
8625-
<pre>{#syntax#}@memcpy(noalias dest: [*]u8, noalias source: [*]const u8, byte_count: usize){#endsyntax#}</pre>
8625+
<pre>{#syntax#}@memcpy(noalias dest: [*]u8, noalias source: [*]const u8, byte_count: usize) void{#endsyntax#}</pre>
86268626
<p>
86278627
This function copies bytes from one region of memory to another. {#syntax#}dest{#endsyntax#} and
86288628
{#syntax#}source{#endsyntax#} are both pointers and must not overlap.
@@ -8641,7 +8641,7 @@ mem.copy(u8, dest[0..byte_count], source[0..byte_count]);{#endsyntax#}</pre>
86418641
{#header_close#}
86428642

86438643
{#header_open|@memset#}
8644-
<pre>{#syntax#}@memset(dest: [*]u8, c: u8, byte_count: usize){#endsyntax#}</pre>
8644+
<pre>{#syntax#}@memset(dest: [*]u8, c: u8, byte_count: usize) void{#endsyntax#}</pre>
86458645
<p>
86468646
This function sets a region of memory to {#syntax#}c{#endsyntax#}. {#syntax#}dest{#endsyntax#} is a pointer.
86478647
</p>
@@ -8753,7 +8753,7 @@ test "@wasmMemoryGrow" {
87538753
{#header_close#}
87548754

87558755
{#header_open|@popCount#}
8756-
<pre>{#syntax#}@popCount(operand: anytype){#endsyntax#}</pre>
8756+
<pre>{#syntax#}@popCount(operand: anytype) anytype{#endsyntax#}</pre>
87578757
<p>{#syntax#}@TypeOf(operand){#endsyntax#} must be an integer type.</p>
87588758
<p>{#syntax#}operand{#endsyntax#} may be an {#link|integer|Integers#} or {#link|vector|Vectors#}.</p>
87598759
<p>Counts the number of bits set in an integer.</p>
@@ -8767,7 +8767,7 @@ test "@wasmMemoryGrow" {
87678767
{#header_close#}
87688768

87698769
{#header_open|@prefetch#}
8770-
<pre>{#syntax#}@prefetch(ptr: anytype, comptime options: std.builtin.PrefetchOptions){#endsyntax#}</pre>
8770+
<pre>{#syntax#}@prefetch(ptr: anytype, comptime options: std.builtin.PrefetchOptions) void{#endsyntax#}</pre>
87718771
<p>
87728772
This builtin tells the compiler to emit a prefetch instruction if supported by the
87738773
target CPU. If the target CPU does not support the requested prefetch instruction,
@@ -8881,21 +8881,21 @@ pub const PrefetchOptions = struct {
88818881
{#header_close#}
88828882

88838883
{#header_open|@setAlignStack#}
8884-
<pre>{#syntax#}@setAlignStack(comptime alignment: u29){#endsyntax#}</pre>
8884+
<pre>{#syntax#}@setAlignStack(comptime alignment: u29) void{#endsyntax#}</pre>
88858885
<p>
88868886
Ensures that a function will have a stack alignment of at least {#syntax#}alignment{#endsyntax#} bytes.
88878887
</p>
88888888
{#header_close#}
88898889

88908890
{#header_open|@setCold#}
8891-
<pre>{#syntax#}@setCold(comptime is_cold: bool){#endsyntax#}</pre>
8891+
<pre>{#syntax#}@setCold(comptime is_cold: bool) void{#endsyntax#}</pre>
88928892
<p>
88938893
Tells the optimizer that a function is rarely called.
88948894
</p>
88958895
{#header_close#}
88968896

88978897
{#header_open|@setEvalBranchQuota#}
8898-
<pre>{#syntax#}@setEvalBranchQuota(comptime new_quota: u32){#endsyntax#}</pre>
8898+
<pre>{#syntax#}@setEvalBranchQuota(comptime new_quota: u32) void{#endsyntax#}</pre>
88998899
<p>
89008900
Changes the maximum number of backwards branches that compile-time code
89018901
execution can use before giving up and making a compile error.
@@ -8930,7 +8930,7 @@ test "foo" {
89308930
{#header_close#}
89318931

89328932
{#header_open|@setFloatMode#}
8933-
<pre>{#syntax#}@setFloatMode(comptime mode: @import("std").builtin.FloatMode){#endsyntax#}</pre>
8933+
<pre>{#syntax#}@setFloatMode(comptime mode: @import("std").builtin.FloatMode) void{#endsyntax#}</pre>
89348934
<p>
89358935
Sets the floating point mode of the current scope. Possible values are:
89368936
</p>

0 commit comments

Comments
 (0)