authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-05-02 11:26:58+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2026-05-03 12:23:30+01:00
loge393962bc2348a03ee53fd0a6e4dec6250842600
tree29554b98e98d6df7c9d13696d8a7652986ca1cd2
parent4c330e053ba45f383a7642da53482dfbce1b50cf
signaturelock-open Commit is signed but in an unrecognized format.

langref: use 'std.lang' instead of 'std.builtin'


4 files changed, 67 insertions(+), 70 deletions(-)

doc/langref.html.in+34-34
......@@ -3763,7 +3763,7 @@ void do_a_thing(struct Foo *foo) {
37633763 <tr>
37643764 <th scope="row">{#syntax#}@Int(x, y){#endsyntax#}</th>
37653765 <td>-</td>
3766 <td>{#syntax#}x{#endsyntax#} is a {#syntax#}std.builtin.Signedness{#endsyntax#}, {#syntax#}y{#endsyntax#} is a {#syntax#}u16{#endsyntax#}</td>
3766 <td>{#syntax#}x{#endsyntax#} is a {#syntax#}std.lang.Signedness{#endsyntax#}, {#syntax#}y{#endsyntax#} is a {#syntax#}u16{#endsyntax#}</td>
37673767 </tr>
37683768 <tr>
37693769 <th scope="row">{#syntax#}@typeInfo(x){#endsyntax#}</th>
......@@ -4373,7 +4373,7 @@ comptime {
43734373 {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float,
43744374 an integer, an enum, or a packed struct.
43754375 </p>
4376 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
4376 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.</p>
43774377 {#see_also|@atomicStore|@atomicRmw||@cmpxchgWeak|@cmpxchgStrong#}
43784378 {#header_close#}
43794379
......@@ -4387,8 +4387,8 @@ comptime {
43874387 {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float,
43884388 an integer, an enum, or a packed struct.
43894389 </p>
4390 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
4391 <p>{#syntax#}AtomicRmwOp{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicRmwOp{#endsyntax#}.</p>
4390 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.</p>
4391 <p>{#syntax#}AtomicRmwOp{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicRmwOp{#endsyntax#}.</p>
43924392 {#see_also|@atomicStore|@atomicLoad|@cmpxchgWeak|@cmpxchgStrong#}
43934393 {#header_close#}
43944394
......@@ -4401,7 +4401,7 @@ comptime {
44014401 {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float,
44024402 an integer, an enum, or a packed struct.
44034403 </p>
4404 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
4404 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.</p>
44054405 {#see_also|@atomicLoad|@atomicRmw|@cmpxchgWeak|@cmpxchgStrong#}
44064406 {#header_close#}
44074407
......@@ -4459,7 +4459,7 @@ comptime {
44594459 {#header_open|@branchHint#}
44604460 <pre>{#syntax#}@branchHint(hint: BranchHint) void{#endsyntax#}</pre>
44614461 <p>Hints to the optimizer how likely a given branch of control flow is to be reached.</p>
4462 <p>{#syntax#}BranchHint{#endsyntax#} can be found with {#syntax#}@import("std").builtin.BranchHint{#endsyntax#}.</p>
4462 <p>{#syntax#}BranchHint{#endsyntax#} can be found with {#syntax#}@import("std").lang.BranchHint{#endsyntax#}.</p>
44634463 <p>This function is only valid as the first statement in a control flow branch, or the first statement in a function.</p>
44644464 {#header_close#}
44654465
......@@ -4526,7 +4526,7 @@ comptime {
45264526 {#header_close#}
45274527
45284528 {#header_open|@call#}
4529 <pre>{#syntax#}@call(modifier: std.builtin.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}</pre>
4529 <pre>{#syntax#}@call(modifier: std.lang.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}</pre>
45304530 <p>
45314531 Calls a function, in the same way that invoking an expression with parentheses does:
45324532 </p>
......@@ -4536,7 +4536,7 @@ comptime {
45364536 {#syntax#}@call{#endsyntax#} allows more flexibility than normal function call syntax does. The
45374537 {#syntax#}CallModifier{#endsyntax#} enum is reproduced here:
45384538 </p>
4539 {#code|builtin.CallModifier struct.zig#}
4539 {#code|lang.CallModifier struct.zig#}
45404540
45414541 {#header_close#}
45424542
......@@ -4576,7 +4576,7 @@ comptime {
45764576 an integer, an enum, or a packed struct.
45774577 </p>
45784578 <p>{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
4579 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
4579 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.</p>
45804580 {#see_also|@atomicStore|@atomicLoad|@atomicRmw|@cmpxchgWeak#}
45814581 {#header_close#}
45824582
......@@ -4608,7 +4608,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
46084608 an integer, an enum, or a packed struct.
46094609 </p>
46104610 <p>{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
4611 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
4611 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.</p>
46124612 {#see_also|@atomicStore|@atomicLoad|@atomicRmw|@cmpxchgStrong#}
46134613 {#header_close#}
46144614
......@@ -4670,28 +4670,28 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
46704670 {#header_close#}
46714671
46724672 {#header_open|@cVaArg#}
4673 <pre>{#syntax#}@cVaArg(operand: *std.builtin.VaList, comptime T: type) T{#endsyntax#}</pre>
4673 <pre>{#syntax#}@cVaArg(operand: *std.lang.VaList, comptime T: type) T{#endsyntax#}</pre>
46744674 <p>
46754675 Implements the C macro {#syntax#}va_arg{#endsyntax#}.
46764676 </p>
46774677 {#see_also|@cVaCopy|@cVaEnd|@cVaStart#}
46784678 {#header_close#}
46794679 {#header_open|@cVaCopy#}
4680 <pre>{#syntax#}@cVaCopy(src: *std.builtin.VaList) std.builtin.VaList{#endsyntax#}</pre>
4680 <pre>{#syntax#}@cVaCopy(src: *std.lang.VaList) std.lang.VaList{#endsyntax#}</pre>
46814681 <p>
46824682 Implements the C macro {#syntax#}va_copy{#endsyntax#}.
46834683 </p>
46844684 {#see_also|@cVaArg|@cVaEnd|@cVaStart#}
46854685 {#header_close#}
46864686 {#header_open|@cVaEnd#}
4687 <pre>{#syntax#}@cVaEnd(src: *std.builtin.VaList) void{#endsyntax#}</pre>
4687 <pre>{#syntax#}@cVaEnd(src: *std.lang.VaList) void{#endsyntax#}</pre>
46884688 <p>
46894689 Implements the C macro {#syntax#}va_end{#endsyntax#}.
46904690 </p>
46914691 {#see_also|@cVaArg|@cVaCopy|@cVaStart#}
46924692 {#header_close#}
46934693 {#header_open|@cVaStart#}
4694 <pre>{#syntax#}@cVaStart() std.builtin.VaList{#endsyntax#}</pre>
4694 <pre>{#syntax#}@cVaStart() std.lang.VaList{#endsyntax#}</pre>
46954695 <p>
46964696 Implements the C macro {#syntax#}va_start{#endsyntax#}. Only valid inside a variadic function.
46974697 </p>
......@@ -4800,7 +4800,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
48004800 {#header_close#}
48014801
48024802 {#header_open|@errorReturnTrace#}
4803 <pre>{#syntax#}@errorReturnTrace() ?*builtin.StackTrace{#endsyntax#}</pre>
4803 <pre>{#syntax#}@errorReturnTrace() ?*std.lang.StackTrace{#endsyntax#}</pre>
48044804 <p>
48054805 If the binary is built with error return tracing, and this function is invoked in a
48064806 function that calls a function with an error or error union return type, returns a
......@@ -4818,7 +4818,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
48184818 {#header_close#}
48194819
48204820 {#header_open|@export#}
4821 <pre>{#syntax#}@export(comptime ptr: *const anyopaque, comptime options: std.builtin.ExportOptions) void{#endsyntax#}</pre>
4821 <pre>{#syntax#}@export(comptime ptr: *const anyopaque, comptime options: std.lang.ExportOptions) void{#endsyntax#}</pre>
48224822 <p>Creates a symbol in the output object file which refers to the target of <code>ptr</code>.</p>
48234823 <p><code>ptr</code> must point to a global variable or a comptime-known constant.</p>
48244824 <p>
......@@ -4844,7 +4844,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
48444844 {#header_close#}
48454845
48464846 {#header_open|@extern#}
4847 <pre>{#syntax#}@extern(T: type, comptime options: std.builtin.ExternOptions) T{#endsyntax#}</pre>
4847 <pre>{#syntax#}@extern(T: type, comptime options: std.lang.ExternOptions) T{#endsyntax#}</pre>
48484848 <p>
48494849 Creates a reference to an external symbol in the output object file.
48504850 T must be a pointer type.
......@@ -5165,8 +5165,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
51655165 <p>
51665166 Invokes the panic handler function. By default the panic handler function
51675167 calls the public {#syntax#}panic{#endsyntax#} function exposed in the root source file, or
5168 if there is not one specified, the {#syntax#}std.builtin.default_panic{#endsyntax#}
5169 function from {#syntax#}std/builtin.zig{#endsyntax#}.
5168 if there is not one specified, the {#syntax#}std.lang.default_panic{#endsyntax#}
5169 function from {#syntax#}std/lang.zig{#endsyntax#}.
51705170 </p>
51715171 <p>Generally it is better to use {#syntax#}@import("std").debug.panic{#endsyntax#}.
51725172 However, {#syntax#}@panic{#endsyntax#} can be useful for 2 scenarios:
......@@ -5205,7 +5205,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
52055205 address to prefetch. This function does not dereference the pointer, it is perfectly legal
52065206 to pass a pointer to invalid memory to this function and no Illegal Behavior will result.
52075207 </p>
5208 <p>{#syntax#}PrefetchOptions{#endsyntax#} can be found with {#syntax#}@import("std").builtin.PrefetchOptions{#endsyntax#}.</p>
5208 <p>{#syntax#}PrefetchOptions{#endsyntax#} can be found with {#syntax#}@import("std").lang.PrefetchOptions{#endsyntax#}.</p>
52095209 {#header_close#}
52105210
52115211 {#header_open|@ptrCast#}
......@@ -5328,7 +5328,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
53285328 The floating point mode is inherited by child scopes, and can be overridden in any scope.
53295329 You can set the floating point mode in a struct or module scope by using a comptime block.
53305330 </p>
5331 <p>{#syntax#}FloatMode{#endsyntax#} can be found with {#syntax#}@import("std").builtin.FloatMode{#endsyntax#}.</p>
5331 <p>{#syntax#}FloatMode{#endsyntax#} can be found with {#syntax#}@import("std").lang.FloatMode{#endsyntax#}.</p>
53325332 {#see_also|Floating Point Operations#}
53335333 {#header_close#}
53345334
......@@ -5464,7 +5464,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
54645464 {#header_close#}
54655465
54665466 {#header_open|@reduce#}
5467 <pre>{#syntax#}@reduce(comptime op: std.builtin.ReduceOp, value: anytype) E{#endsyntax#}</pre>
5467 <pre>{#syntax#}@reduce(comptime op: std.lang.ReduceOp, value: anytype) E{#endsyntax#}</pre>
54685468 <p>
54695469 Transforms a {#link|vector|Vectors#} into a scalar value (of type <code>E</code>)
54705470 by performing a sequential horizontal reduction of its elements using the
......@@ -5494,7 +5494,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
54945494 {#header_close#}
54955495
54965496 {#header_open|@src#}
5497 <pre>{#syntax#}@src() std.builtin.SourceLocation{#endsyntax#}</pre>
5497 <pre>{#syntax#}@src() std.lang.SourceLocation{#endsyntax#}</pre>
54985498 <p>
54995499 Returns a {#syntax#}SourceLocation{#endsyntax#} struct representing the function's name and location in the source code. This must be called in a function.
55005500 </p>
......@@ -5721,7 +5721,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
57215721 {#header_close#}
57225722
57235723 {#header_open|@Int#}
5724 <pre>{#syntax#}@Int(comptime signedness: std.builtin.Signedness, comptime bits: u16) type{#endsyntax#}</pre>
5724 <pre>{#syntax#}@Int(comptime signedness: std.lang.Signedness, comptime bits: u16) type{#endsyntax#}</pre>
57255725 <p>Returns an integer type with the given signedness and bit width.</p>
57265726 <p>For instance, {#syntax#}@Int(.unsigned, 18){#endsyntax#} returns the type {#syntax#}u18{#endsyntax#}.</p>
57275727 {#header_close#}
......@@ -5733,8 +5733,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
57335733
57345734 {#header_open|@Pointer#}
57355735 <pre>{#syntax#}@Pointer(
5736 comptime size: std.builtin.Type.Pointer.Size,
5737 comptime attrs: std.builtin.Type.Pointer.Attributes,
5736 comptime size: std.lang.Type.Pointer.Size,
5737 comptime attrs: std.lang.Type.Pointer.Attributes,
57385738 comptime Element: type,
57395739 comptime sentinel: ?Element,
57405740) type{#endsyntax#}</pre>
......@@ -5744,32 +5744,32 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
57445744 {#header_open|@Fn#}
57455745 <pre>{#syntax#}@Fn(
57465746 comptime param_types: []const type,
5747 comptime param_attrs: *const [param_types.len]std.builtin.Type.Fn.Param.Attributes,
5747 comptime param_attrs: *const [param_types.len]std.lang.Type.Fn.Param.Attributes,
57485748 comptime ReturnType: type,
5749 comptime attrs: std.builtin.Type.Fn.Attributes,
5749 comptime attrs: std.lang.Type.Fn.Attributes,
57505750) type{#endsyntax#}</pre>
57515751 <p>Returns a {#link|function|Functions#} type with the properties specified by the arguments.</p>
57525752 {#header_close#}
57535753
57545754 {#header_open|@Struct#}
57555755 <pre>{#syntax#}@Struct(
5756 comptime layout: std.builtin.Type.ContainerLayout,
5756 comptime layout: std.lang.Type.ContainerLayout,
57575757 comptime BackingInt: ?type,
57585758 comptime field_names: []const []const u8,
57595759 comptime field_types: *const [field_names.len]type,
5760 comptime field_attrs: *const [field_names.len]std.builtin.Type.StructField.Attributes,
5760 comptime field_attrs: *const [field_names.len]std.lang.Type.StructField.Attributes,
57615761) type{#endsyntax#}</pre>
57625762 <p>Returns a {#link|struct#} type with the properties specified by the arguments.</p>
57635763 {#header_close#}
57645764
57655765 {#header_open|@Union#}
57665766 <pre>{#syntax#}@Union(
5767 comptime layout: std.builtin.Type.ContainerLayout,
5767 comptime layout: std.lang.Type.ContainerLayout,
57685768 /// Either the integer tag type, or the integer backing type, depending on `layout`.
57695769 comptime ArgType: ?type,
57705770 comptime field_names: []const []const u8,
57715771 comptime field_types: *const [field_names.len]type,
5772 comptime field_attrs: *const [field_names.len]std.builtin.Type.UnionField.Attributes,
5772 comptime field_attrs: *const [field_names.len]std.lang.Type.UnionField.Attributes,
57735773) type{#endsyntax#}</pre>
57745774 <p>Returns a {#link|union#} type with the properties specified by the arguments.</p>
57755775 {#header_close#}
......@@ -5777,7 +5777,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
57775777 {#header_open|@Enum#}
57785778 <pre>{#syntax#}@Enum(
57795779 comptime TagInt: type,
5780 comptime mode: std.builtin.Type.Enum.Mode,
5780 comptime mode: std.lang.Type.Enum.Mode,
57815781 comptime field_names: []const []const u8,
57825782 comptime field_values: *const [field_names.len]TagInt,
57835783) type{#endsyntax#}</pre>
......@@ -5785,7 +5785,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
57855785 {#header_close#}
57865786
57875787 {#header_open|@typeInfo#}
5788 <pre>{#syntax#}@typeInfo(comptime T: type) std.builtin.Type{#endsyntax#}</pre>
5788 <pre>{#syntax#}@typeInfo(comptime T: type) std.lang.Type{#endsyntax#}</pre>
57895789 <p>
57905790 Provides type reflection.
57915791 </p>
doc/langref/builtin.CallModifier struct.zig deleted-32
......@@ -1,32 +0,0 @@
1pub const CallModifier = enum {
2 /// Equivalent to function call syntax.
3 auto,
4
5 /// Prevents tail call optimization. This guarantees that the return
6 /// address will point to the callsite, as opposed to the callsite's
7 /// callsite. If the call is otherwise required to be tail-called
8 /// or inlined, a compile error is emitted instead.
9 never_tail,
10
11 /// Guarantees that the call will not be inlined. If the call is
12 /// otherwise required to be inlined, a compile error is emitted instead.
13 never_inline,
14
15 /// Asserts that the function call will not suspend. This allows a
16 /// non-async function to call an async function.
17 no_suspend,
18
19 /// Guarantees that the call will be generated with tail call optimization.
20 /// If this is not possible, a compile error is emitted instead.
21 always_tail,
22
23 /// Guarantees that the call will be inlined at the callsite.
24 /// If this is not possible, a compile error is emitted instead.
25 always_inline,
26
27 /// Evaluates the call at compile-time. If the call cannot be completed at
28 /// compile-time, a compile error is emitted instead.
29 compile_time,
30};
31
32// syntax
doc/langref/lang.CallModifier struct.zig created+32
......@@ -0,0 +1,32 @@
1pub const CallModifier = enum {
2 /// Equivalent to function call syntax.
3 auto,
4
5 /// Prevents tail call optimization. This guarantees that the return
6 /// address will point to the callsite, as opposed to the callsite's
7 /// callsite. If the call is otherwise required to be tail-called
8 /// or inlined, a compile error is emitted instead.
9 never_tail,
10
11 /// Guarantees that the call will not be inlined. If the call is
12 /// otherwise required to be inlined, a compile error is emitted instead.
13 never_inline,
14
15 /// Asserts that the function call will not suspend. This allows a
16 /// non-async function to call an async function.
17 no_suspend,
18
19 /// Guarantees that the call will be generated with tail call optimization.
20 /// If this is not possible, a compile error is emitted instead.
21 always_tail,
22
23 /// Guarantees that the call will be inlined at the callsite.
24 /// If this is not possible, a compile error is emitted instead.
25 always_inline,
26
27 /// Evaluates the call at compile-time. If the call cannot be completed at
28 /// compile-time, a compile error is emitted instead.
29 compile_time,
30};
31
32// syntax
doc/langref/test_noreturn_from_exit.zig+1-4
......@@ -1,10 +1,7 @@
11const std = @import("std");
2const builtin = @import("builtin");
3const native_arch = builtin.cpu.arch;
42const expectEqual = std.testing.expectEqual;
53
6const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .{ .x86_stdcall = .{} } else .c;
7extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn;
4extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(.winapi) noreturn;
85
96test "foo" {
107 const value = bar() catch ExitProcess(1);