diff --git a/doc/langref.html.in b/doc/langref.html.in index 074c324de7357c983a918a59a56c05a7d8d4133a..bcfda4d66adc693e415a70772290ac937468d2ef 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -3763,7 +3763,7 @@ void do_a_thing(struct Foo *foo) {
{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.
+{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.
{#see_also|@atomicStore|@atomicRmw||@cmpxchgWeak|@cmpxchgStrong#} {#header_close#} @@ -4387,8 +4387,8 @@ comptime { {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer, an enum, or a packed struct. -{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.
-{#syntax#}AtomicRmwOp{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicRmwOp{#endsyntax#}.
+{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.
+{#syntax#}AtomicRmwOp{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicRmwOp{#endsyntax#}.
{#see_also|@atomicStore|@atomicLoad|@cmpxchgWeak|@cmpxchgStrong#} {#header_close#} @@ -4401,7 +4401,7 @@ comptime { {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float, an integer, an enum, or a packed struct. -{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.
+{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.
{#see_also|@atomicLoad|@atomicRmw|@cmpxchgWeak|@cmpxchgStrong#} {#header_close#} @@ -4459,7 +4459,7 @@ comptime { {#header_open|@branchHint#}{#syntax#}@branchHint(hint: BranchHint) void{#endsyntax#}
Hints to the optimizer how likely a given branch of control flow is to be reached.
-{#syntax#}BranchHint{#endsyntax#} can be found with {#syntax#}@import("std").builtin.BranchHint{#endsyntax#}.
+{#syntax#}BranchHint{#endsyntax#} can be found with {#syntax#}@import("std").lang.BranchHint{#endsyntax#}.
This function is only valid as the first statement in a control flow branch, or the first statement in a function.
{#header_close#} @@ -4526,7 +4526,7 @@ comptime { {#header_close#} {#header_open|@call#} -{#syntax#}@call(modifier: std.builtin.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}
+ {#syntax#}@call(modifier: std.lang.CallModifier, function: anytype, args: anytype) anytype{#endsyntax#}
Calls a function, in the same way that invoking an expression with parentheses does:
@@ -4536,7 +4536,7 @@ comptime { {#syntax#}@call{#endsyntax#} allows more flexibility than normal function call syntax does. The {#syntax#}CallModifier{#endsyntax#} enum is reproduced here: - {#code|builtin.CallModifier struct.zig#} + {#code|lang.CallModifier struct.zig#} {#header_close#} @@ -4576,7 +4576,7 @@ comptime { an integer, an enum, or a packed struct.{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}
-{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.
+{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.
{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@cmpxchgWeak#} {#header_close#} @@ -4608,7 +4608,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val an integer, an enum, or a packed struct.{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}
-{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.
+{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").lang.AtomicOrder{#endsyntax#}.
{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@cmpxchgStrong#} {#header_close#} @@ -4670,28 +4670,28 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@cVaArg#} -{#syntax#}@cVaArg(operand: *std.builtin.VaList, comptime T: type) T{#endsyntax#}
+ {#syntax#}@cVaArg(operand: *std.lang.VaList, comptime T: type) T{#endsyntax#}
Implements the C macro {#syntax#}va_arg{#endsyntax#}.
{#see_also|@cVaCopy|@cVaEnd|@cVaStart#} {#header_close#} {#header_open|@cVaCopy#} -{#syntax#}@cVaCopy(src: *std.builtin.VaList) std.builtin.VaList{#endsyntax#}
+ {#syntax#}@cVaCopy(src: *std.lang.VaList) std.lang.VaList{#endsyntax#}
Implements the C macro {#syntax#}va_copy{#endsyntax#}.
{#see_also|@cVaArg|@cVaEnd|@cVaStart#} {#header_close#} {#header_open|@cVaEnd#} -{#syntax#}@cVaEnd(src: *std.builtin.VaList) void{#endsyntax#}
+ {#syntax#}@cVaEnd(src: *std.lang.VaList) void{#endsyntax#}
Implements the C macro {#syntax#}va_end{#endsyntax#}.
{#see_also|@cVaArg|@cVaCopy|@cVaStart#} {#header_close#} {#header_open|@cVaStart#} -{#syntax#}@cVaStart() std.builtin.VaList{#endsyntax#}
+ {#syntax#}@cVaStart() std.lang.VaList{#endsyntax#}
Implements the C macro {#syntax#}va_start{#endsyntax#}. Only valid inside a variadic function.
@@ -4800,7 +4800,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@errorReturnTrace#} -{#syntax#}@errorReturnTrace() ?*builtin.StackTrace{#endsyntax#}
+ {#syntax#}@errorReturnTrace() ?*std.lang.StackTrace{#endsyntax#}
If the binary is built with error return tracing, and this function is invoked in a 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 {#header_close#} {#header_open|@export#} -
{#syntax#}@export(comptime ptr: *const anyopaque, comptime options: std.builtin.ExportOptions) void{#endsyntax#}
+ {#syntax#}@export(comptime ptr: *const anyopaque, comptime options: std.lang.ExportOptions) void{#endsyntax#}
Creates a symbol in the output object file which refers to the target of ptr.
ptr must point to a global variable or a comptime-known constant.
@@ -4844,7 +4844,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@extern#} -
{#syntax#}@extern(T: type, comptime options: std.builtin.ExternOptions) T{#endsyntax#}
+ {#syntax#}@extern(T: type, comptime options: std.lang.ExternOptions) T{#endsyntax#}
Creates a reference to an external symbol in the output object file. T must be a pointer type. @@ -5165,8 +5165,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
Invokes the panic handler function. By default the panic handler function calls the public {#syntax#}panic{#endsyntax#} function exposed in the root source file, or - if there is not one specified, the {#syntax#}std.builtin.default_panic{#endsyntax#} - function from {#syntax#}std/builtin.zig{#endsyntax#}. + if there is not one specified, the {#syntax#}std.lang.default_panic{#endsyntax#} + function from {#syntax#}std/lang.zig{#endsyntax#}.
Generally it is better to use {#syntax#}@import("std").debug.panic{#endsyntax#}. 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 address to prefetch. This function does not dereference the pointer, it is perfectly legal to pass a pointer to invalid memory to this function and no Illegal Behavior will result.
-{#syntax#}PrefetchOptions{#endsyntax#} can be found with {#syntax#}@import("std").builtin.PrefetchOptions{#endsyntax#}.
+{#syntax#}PrefetchOptions{#endsyntax#} can be found with {#syntax#}@import("std").lang.PrefetchOptions{#endsyntax#}.
{#header_close#} {#header_open|@ptrCast#} @@ -5328,7 +5328,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val The floating point mode is inherited by child scopes, and can be overridden in any scope. You can set the floating point mode in a struct or module scope by using a comptime block. -{#syntax#}FloatMode{#endsyntax#} can be found with {#syntax#}@import("std").builtin.FloatMode{#endsyntax#}.
+{#syntax#}FloatMode{#endsyntax#} can be found with {#syntax#}@import("std").lang.FloatMode{#endsyntax#}.
{#see_also|Floating Point Operations#} {#header_close#} @@ -5464,7 +5464,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@reduce#} -{#syntax#}@reduce(comptime op: std.builtin.ReduceOp, value: anytype) E{#endsyntax#}
+ {#syntax#}@reduce(comptime op: std.lang.ReduceOp, value: anytype) E{#endsyntax#}
Transforms a {#link|vector|Vectors#} into a scalar value (of type E)
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
{#header_close#}
{#header_open|@src#}
-
{#syntax#}@src() std.builtin.SourceLocation{#endsyntax#}
+ {#syntax#}@src() std.lang.SourceLocation{#endsyntax#}
Returns a {#syntax#}SourceLocation{#endsyntax#} struct representing the function's name and location in the source code. This must be called in a function.
@@ -5721,7 +5721,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_close#} {#header_open|@Int#} -{#syntax#}@Int(comptime signedness: std.builtin.Signedness, comptime bits: u16) type{#endsyntax#}
+ {#syntax#}@Int(comptime signedness: std.lang.Signedness, comptime bits: u16) type{#endsyntax#}
Returns an integer type with the given signedness and bit width.
For instance, {#syntax#}@Int(.unsigned, 18){#endsyntax#} returns the type {#syntax#}u18{#endsyntax#}.
{#header_close#} @@ -5733,8 +5733,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_open|@Pointer#}{#syntax#}@Pointer(
- comptime size: std.builtin.Type.Pointer.Size,
- comptime attrs: std.builtin.Type.Pointer.Attributes,
+ comptime size: std.lang.Type.Pointer.Size,
+ comptime attrs: std.lang.Type.Pointer.Attributes,
comptime Element: type,
comptime sentinel: ?Element,
) type{#endsyntax#}
@@ -5744,32 +5744,32 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#header_open|@Fn#}
{#syntax#}@Fn(
comptime param_types: []const type,
- comptime param_attrs: *const [param_types.len]std.builtin.Type.Fn.Param.Attributes,
+ comptime param_attrs: *const [param_types.len]std.lang.Type.Fn.Param.Attributes,
comptime ReturnType: type,
- comptime attrs: std.builtin.Type.Fn.Attributes,
+ comptime attrs: std.lang.Type.Fn.Attributes,
) type{#endsyntax#}
Returns a {#link|function|Functions#} type with the properties specified by the arguments.
{#header_close#} {#header_open|@Struct#}{#syntax#}@Struct(
- comptime layout: std.builtin.Type.ContainerLayout,
+ comptime layout: std.lang.Type.ContainerLayout,
comptime BackingInt: ?type,
comptime field_names: []const []const u8,
comptime field_types: *const [field_names.len]type,
- comptime field_attrs: *const [field_names.len]std.builtin.Type.StructField.Attributes,
+ comptime field_attrs: *const [field_names.len]std.lang.Type.StructField.Attributes,
) type{#endsyntax#}
Returns a {#link|struct#} type with the properties specified by the arguments.
{#header_close#} {#header_open|@Union#}{#syntax#}@Union(
- comptime layout: std.builtin.Type.ContainerLayout,
+ comptime layout: std.lang.Type.ContainerLayout,
/// Either the integer tag type, or the integer backing type, depending on `layout`.
comptime ArgType: ?type,
comptime field_names: []const []const u8,
comptime field_types: *const [field_names.len]type,
- comptime field_attrs: *const [field_names.len]std.builtin.Type.UnionField.Attributes,
+ comptime field_attrs: *const [field_names.len]std.lang.Type.UnionField.Attributes,
) type{#endsyntax#}
Returns a {#link|union#} type with the properties specified by the arguments.
{#header_close#} @@ -5777,7 +5777,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val {#header_open|@Enum#}{#syntax#}@Enum(
comptime TagInt: type,
- comptime mode: std.builtin.Type.Enum.Mode,
+ comptime mode: std.lang.Type.Enum.Mode,
comptime field_names: []const []const u8,
comptime field_values: *const [field_names.len]TagInt,
) type{#endsyntax#}
@@ -5785,7 +5785,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
{#header_close#}
{#header_open|@typeInfo#}
- {#syntax#}@typeInfo(comptime T: type) std.builtin.Type{#endsyntax#}
+ {#syntax#}@typeInfo(comptime T: type) std.lang.Type{#endsyntax#}
Provides type reflection.
diff --git a/doc/langref/builtin.CallModifier struct.zig b/doc/langref/builtin.CallModifier struct.zig deleted file mode 100644 index 2626441a9e294fc449e7bc4dd9cf375ba2576a58..0000000000000000000000000000000000000000 --- a/doc/langref/builtin.CallModifier struct.zig +++ /dev/null @@ -1,32 +0,0 @@ -pub const CallModifier = enum { - /// Equivalent to function call syntax. - auto, - - /// Prevents tail call optimization. This guarantees that the return - /// address will point to the callsite, as opposed to the callsite's - /// callsite. If the call is otherwise required to be tail-called - /// or inlined, a compile error is emitted instead. - never_tail, - - /// Guarantees that the call will not be inlined. If the call is - /// otherwise required to be inlined, a compile error is emitted instead. - never_inline, - - /// Asserts that the function call will not suspend. This allows a - /// non-async function to call an async function. - no_suspend, - - /// Guarantees that the call will be generated with tail call optimization. - /// If this is not possible, a compile error is emitted instead. - always_tail, - - /// Guarantees that the call will be inlined at the callsite. - /// If this is not possible, a compile error is emitted instead. - always_inline, - - /// Evaluates the call at compile-time. If the call cannot be completed at - /// compile-time, a compile error is emitted instead. - compile_time, -}; - -// syntax diff --git a/doc/langref/lang.CallModifier struct.zig b/doc/langref/lang.CallModifier struct.zig new file mode 100644 index 0000000000000000000000000000000000000000..2626441a9e294fc449e7bc4dd9cf375ba2576a58 --- /dev/null +++ b/doc/langref/lang.CallModifier struct.zig @@ -0,0 +1,32 @@ +pub const CallModifier = enum { + /// Equivalent to function call syntax. + auto, + + /// Prevents tail call optimization. This guarantees that the return + /// address will point to the callsite, as opposed to the callsite's + /// callsite. If the call is otherwise required to be tail-called + /// or inlined, a compile error is emitted instead. + never_tail, + + /// Guarantees that the call will not be inlined. If the call is + /// otherwise required to be inlined, a compile error is emitted instead. + never_inline, + + /// Asserts that the function call will not suspend. This allows a + /// non-async function to call an async function. + no_suspend, + + /// Guarantees that the call will be generated with tail call optimization. + /// If this is not possible, a compile error is emitted instead. + always_tail, + + /// Guarantees that the call will be inlined at the callsite. + /// If this is not possible, a compile error is emitted instead. + always_inline, + + /// Evaluates the call at compile-time. If the call cannot be completed at + /// compile-time, a compile error is emitted instead. + compile_time, +}; + +// syntax diff --git a/doc/langref/test_noreturn_from_exit.zig b/doc/langref/test_noreturn_from_exit.zig index 22ea8b4f491f5f01342af8ddb8a8324684a24384..ce7d5122ec49edbb888e235142f38035a82d736b 100644 --- a/doc/langref/test_noreturn_from_exit.zig +++ b/doc/langref/test_noreturn_from_exit.zig @@ -1,10 +1,7 @@ const std = @import("std"); -const builtin = @import("builtin"); -const native_arch = builtin.cpu.arch; const expectEqual = std.testing.expectEqual; -const WINAPI: std.builtin.CallingConvention = if (native_arch == .x86) .{ .x86_stdcall = .{} } else .c; -extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(WINAPI) noreturn; +extern "kernel32" fn ExitProcess(exit_code: c_uint) callconv(.winapi) noreturn; test "foo" { const value = bar() catch ExitProcess(1);