Update data for zig 0.7.0 and the current master branch
This commit is contained in:
parent
72f811e8dc
commit
ccfb18ec54
@ -37,7 +37,7 @@ The `zls` executable will be saved to `zls\zig-cache\bin`.
|
||||
|
||||
| Option | Type | Default Value | What it Does |
|
||||
| --- | --- | --- | --- |
|
||||
| `-Ddata_version` | `string` (master or 0.6.0) | master | The data file version. This selects the files in the `src/data` folder that correspond to the Zig version being served.|
|
||||
| `-Ddata_version` | `string` (master or 0.7.0) | master | The data file version. This selects the files in the `src/data` folder that correspond to the Zig version being served.|
|
||||
|
||||
Then, you can use the `zls` executable in an editor of your choice that has a Zig language server client!
|
||||
|
||||
|
@ -134,7 +134,7 @@ pub fn build(b: *std.build.Builder) !void {
|
||||
exe.addBuildOption(
|
||||
[]const u8,
|
||||
"data_version",
|
||||
b.option([]const u8, "data_version", "The data version - either 0.6.0 or master.") orelse "master",
|
||||
b.option([]const u8, "data_version", "The data version - either 0.7.0 or master.") orelse "master",
|
||||
);
|
||||
|
||||
exe.addPackage(.{ .name = "known-folders", .path = "src/known-folders/known-folders.zig" });
|
||||
|
@ -15,8 +15,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@alignCast",
|
||||
.signature = "@alignCast(comptime alignment: u29, ptr: var) var",
|
||||
.snippet = "@alignCast(${1:comptime alignment: u29}, ${2:ptr: var})",
|
||||
.signature = "@alignCast(comptime alignment: u29, ptr: anytype) anytype",
|
||||
.snippet = "@alignCast(${1:comptime alignment: u29}, ${2:ptr: anytype})",
|
||||
.documentation =
|
||||
\\ ptr can be *T, fn(), ?*T, ?fn(), or []T. It returns the same type as ptr except with the alignment adjusted to the new value.
|
||||
\\A pointer alignment safety check is added to the generated code to make sure the pointer is aligned as promised.
|
||||
@ -28,9 +28,9 @@ pub const builtins = [_]Builtin{
|
||||
.documentation =
|
||||
\\ This function returns the number of bytes that this type should be aligned to for the current target to match the C ABI. When the child type of a pointer has this alignment, the alignment can be omitted from the type.
|
||||
\\```zig
|
||||
\\const assert = @import("std").debug.assert;
|
||||
\\const expect = @import("std").testing.expect;
|
||||
\\comptime {
|
||||
\\ assert(*u32 == *align(@alignOf(u32)) u32);
|
||||
\\ expect(*u32 == *align(@alignOf(u32)) u32);
|
||||
\\}
|
||||
\\```
|
||||
\\ The result is a target-specific compile time constant. It is guaranteed to be less than or equal to @sizeOf(T).
|
||||
@ -44,8 +44,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@asyncCall",
|
||||
.signature = "@asyncCall(frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8, result_ptr, function_ptr, args: ...) anyframe->T",
|
||||
.snippet = "@asyncCall(${1:frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8}, ${2:result_ptr}, ${3:function_ptr}, ${4:args: ...})",
|
||||
.signature = "@asyncCall(frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8, result_ptr, function_ptr, args: anytype) anyframe->T",
|
||||
.snippet = "@asyncCall(${1:frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8}, ${2:result_ptr}, ${3:function_ptr}, ${4:args: anytype})",
|
||||
.documentation =
|
||||
\\ @asyncCall performs an async call on a function pointer, which may or may not be an async function.
|
||||
\\ The provided frame_buffer must be large enough to fit the entire function frame. This size can be determined with @frameSize. To provide a too-small buffer invokes safety-checked Undefined Behavior.
|
||||
@ -53,22 +53,22 @@ pub const builtins = [_]Builtin{
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const assert = std.debug.assert;
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\test "async fn pointer in a struct field" {
|
||||
\\ var data: i32 = 1;
|
||||
\\ const Foo = struct {
|
||||
\\ bar: async fn (*i32) void,
|
||||
\\ bar: fn (*i32) callconv(.Async) void,
|
||||
\\ };
|
||||
\\ var foo = Foo{ .bar = func };
|
||||
\\ var bytes: [64]u8 align(@alignOf(@Frame(func))) = undefined;
|
||||
\\ const f = @asyncCall(&bytes, {}, foo.bar, &data);
|
||||
\\ assert(data == 2);
|
||||
\\ const f = @asyncCall(&bytes, {}, foo.bar, .{&data});
|
||||
\\ expect(data == 2);
|
||||
\\ resume f;
|
||||
\\ assert(data == 4);
|
||||
\\ expect(data == 4);
|
||||
\\}
|
||||
\\
|
||||
\\async fn func(y: *i32) void {
|
||||
\\fn func(y: *i32) void {
|
||||
\\ defer y.* += 2;
|
||||
\\ y.* += 1;
|
||||
\\ suspend;
|
||||
@ -87,7 +87,7 @@ pub const builtins = [_]Builtin{
|
||||
.snippet = "@atomicLoad(${1:comptime T: type}, ${2:ptr: *const T}, ${3:comptime ordering: builtin.AtomicOrder})",
|
||||
.documentation =
|
||||
\\ This builtin function atomically dereferences a pointer and returns the value.
|
||||
\\ T must be a bool, a float, an integer or an enum.
|
||||
\\ T must be a pointer, a bool, a float, an integer or an enum.
|
||||
},
|
||||
.{
|
||||
.name = "@atomicRmw",
|
||||
@ -95,7 +95,7 @@ pub const builtins = [_]Builtin{
|
||||
.snippet = "@atomicRmw(${1:comptime T: type}, ${2:ptr: *T}, ${3:comptime op: builtin.AtomicRmwOp}, ${4:operand: T}, ${5:comptime ordering: builtin.AtomicOrder})",
|
||||
.documentation =
|
||||
\\ This builtin function atomically modifies memory and then returns the previous value.
|
||||
\\ T must be a bool, a float, an integer or an enum.
|
||||
\\ T must be a pointer, a bool, a float, an integer or an enum.
|
||||
\\ Supported operations:
|
||||
},
|
||||
.{
|
||||
@ -104,12 +104,12 @@ pub const builtins = [_]Builtin{
|
||||
.snippet = "@atomicStore(${1:comptime T: type}, ${2:ptr: *T}, ${3:value: T}, ${4:comptime ordering: builtin.AtomicOrder})",
|
||||
.documentation =
|
||||
\\ This builtin function atomically stores a value.
|
||||
\\ T must be a bool, a float, an integer or an enum.
|
||||
\\ T must be a pointer, a bool, a float, an integer or an enum.
|
||||
},
|
||||
.{
|
||||
.name = "@bitCast",
|
||||
.signature = "@bitCast(comptime DestType: type, value: var) DestType",
|
||||
.snippet = "@bitCast(${1:comptime DestType: type}, ${2:value: var})",
|
||||
.signature = "@bitCast(comptime DestType: type, value: anytype) DestType",
|
||||
.snippet = "@bitCast(${1:comptime DestType: type}, ${2:value: anytype})",
|
||||
.documentation =
|
||||
\\ Converts a value of one type to another type.
|
||||
\\ Asserts that @sizeOf(@TypeOf(value)) == @sizeOf(DestType).
|
||||
@ -184,16 +184,16 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@call",
|
||||
.signature = "@call(options: std.builtin.CallOptions, function: var, args: var) var",
|
||||
.snippet = "@call(${1:options: std.builtin.CallOptions}, ${2:function: var}, ${3:args: var})",
|
||||
.signature = "@call(options: std.builtin.CallOptions, function: anytype, args: anytype) anytype",
|
||||
.snippet = "@call(${1:options: std.builtin.CallOptions}, ${2:function: anytype}, ${3:args: anytype})",
|
||||
.documentation =
|
||||
\\ Calls a function, in the same way that invoking an expression with parentheses does:
|
||||
\\call.zig
|
||||
\\```zig
|
||||
\\const assert = @import("std").debug.assert;
|
||||
\\const expect = @import("std").testing.expect;
|
||||
\\
|
||||
\\test "noinline function call" {
|
||||
\\ assert(@call(.{}, add, .{3, 9}) == 12);
|
||||
\\ expect(@call(.{}, add, .{3, 9}) == 12);
|
||||
\\}
|
||||
\\
|
||||
\\fn add(a: i32, b: i32) i32 {
|
||||
@ -309,8 +309,8 @@ pub const builtins = [_]Builtin{
|
||||
\\}
|
||||
\\```
|
||||
\\ If you are using cmpxchg in a loop, @cmpxchgWeak is the better choice, because it can be implemented more efficiently in machine instructions.
|
||||
\\ T must be a bool, a float, an integer or an enum.
|
||||
\\@TypeOf(ptr).alignment must be >= @sizeOf(T).
|
||||
\\ T must be a pointer, a bool, a float, an integer or an enum.
|
||||
\\@typeInfo(@TypeOf(ptr)).Pointer.alignment must be >= @sizeOf(T).
|
||||
},
|
||||
.{
|
||||
.name = "@cmpxchgWeak",
|
||||
@ -330,8 +330,8 @@ pub const builtins = [_]Builtin{
|
||||
\\}
|
||||
\\```
|
||||
\\ If you are using cmpxchg in a loop, the sporadic failure will be no problem, and cmpxchgWeak is the better choice, because it can be implemented more efficiently in machine instructions. However if you need a stronger guarantee, use @cmpxchgStrong.
|
||||
\\ T must be a bool, a float, an integer or an enum.
|
||||
\\@TypeOf(ptr).alignment must be >= @sizeOf(T).
|
||||
\\ T must be a pointer, a bool, a float, an integer or an enum.
|
||||
\\@typeInfo(@TypeOf(ptr)).Pointer.alignment must be >= @sizeOf(T).
|
||||
},
|
||||
.{
|
||||
.name = "@compileError",
|
||||
@ -351,7 +351,7 @@ pub const builtins = [_]Builtin{
|
||||
\\ This function can be used to do "printf debugging" on compile-time executing code.
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const warn = @import("std").debug.warn;
|
||||
\\const print = @import("std").debug.print;
|
||||
\\
|
||||
\\const num1 = blk: {
|
||||
\\ var val1: i32 = 99;
|
||||
@ -363,7 +363,7 @@ pub const builtins = [_]Builtin{
|
||||
\\test "main" {
|
||||
\\ @compileLog("comptime in main");
|
||||
\\
|
||||
\\ warn("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\ print("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
@ -373,17 +373,17 @@ pub const builtins = [_]Builtin{
|
||||
\\./docgen_tmp/test.zig:11:5: error: found compile log statement
|
||||
\\ @compileLog("comptime in main");
|
||||
\\ ^
|
||||
\\./docgen_tmp/test.zig:1:34: note: referenced here
|
||||
\\const warn = @import("std").debug.warn;
|
||||
\\./docgen_tmp/test.zig:1:35: note: referenced here
|
||||
\\const print = @import("std").debug.print;
|
||||
\\ ^
|
||||
\\./docgen_tmp/test.zig:13:5: note: referenced here
|
||||
\\ warn("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\ print("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\ ^
|
||||
\\./docgen_tmp/test.zig:5:5: error: found compile log statement
|
||||
\\ @compileLog("comptime val1 = ", val1);
|
||||
\\ ^
|
||||
\\./docgen_tmp/test.zig:13:45: note: referenced here
|
||||
\\ warn("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\./docgen_tmp/test.zig:13:46: note: referenced here
|
||||
\\ print("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\ ^
|
||||
\\
|
||||
\\```
|
||||
@ -391,7 +391,7 @@ pub const builtins = [_]Builtin{
|
||||
\\ If all @compileLog calls are removed or not encountered by analysis, the program compiles successfully and the generated executable prints:
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const warn = @import("std").debug.warn;
|
||||
\\const print = @import("std").debug.print;
|
||||
\\
|
||||
\\const num1 = blk: {
|
||||
\\ var val1: i32 = 99;
|
||||
@ -400,7 +400,7 @@ pub const builtins = [_]Builtin{
|
||||
\\};
|
||||
\\
|
||||
\\test "main" {
|
||||
\\ warn("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\ print("Runtime in main, num1 = {}.\n", .{num1});
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
@ -459,8 +459,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@enumToInt",
|
||||
.signature = "@enumToInt(enum_or_tagged_union: var) var",
|
||||
.snippet = "@enumToInt(${1:enum_or_tagged_union: var})",
|
||||
.signature = "@enumToInt(enum_or_tagged_union: anytype) anytype",
|
||||
.snippet = "@enumToInt(${1:enum_or_tagged_union: anytype})",
|
||||
.documentation =
|
||||
\\ Converts an enumeration value into its integer tag type. When a tagged union is passed, the tag value is used as the enumeration value.
|
||||
\\ If there is only one possible enum value, the resut is a comptime_int known at comptime.
|
||||
@ -482,22 +482,22 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@errorToInt",
|
||||
.signature = "@errorToInt(err: var) std.meta.IntType(false, @sizeOf(anyerror) * 8)",
|
||||
.snippet = "@errorToInt(${1:err: var})",
|
||||
.signature = "@errorToInt(err: anytype) std.meta.IntType(false, @sizeOf(anyerror) * 8)",
|
||||
.snippet = "@errorToInt(${1:err: anytype})",
|
||||
.documentation =
|
||||
\\ Supports the following types:
|
||||
},
|
||||
.{
|
||||
.name = "@errSetCast",
|
||||
.signature = "@errSetCast(comptime T: DestType, value: var) DestType",
|
||||
.snippet = "@errSetCast(${1:comptime T: DestType}, ${2:value: var})",
|
||||
.signature = "@errSetCast(comptime T: DestType, value: anytype) DestType",
|
||||
.snippet = "@errSetCast(${1:comptime T: DestType}, ${2:value: anytype})",
|
||||
.documentation =
|
||||
\\ Converts an error value from one error set to another error set. Attempting to convert an error which is not in the destination error set results in safety-protected Undefined Behavior.
|
||||
},
|
||||
.{
|
||||
.name = "@export",
|
||||
.signature = "@export(target: var, comptime options: std.builtin.ExportOptions) void",
|
||||
.snippet = "@export(${1:target: var}, ${2:comptime options: std.builtin.ExportOptions})",
|
||||
.signature = "@export(target: anytype, comptime options: std.builtin.ExportOptions) void",
|
||||
.snippet = "@export(${1:target: anytype}, ${2:comptime options: std.builtin.ExportOptions})",
|
||||
.documentation =
|
||||
\\ Creates a symbol in the output object file.
|
||||
\\ This function can be called from a comptime block to conditionally export symbols. When target is a function with the C calling convention and options.linkage is Strong, this is equivalent to the export keyword used on a function:
|
||||
@ -530,7 +530,7 @@ pub const builtins = [_]Builtin{
|
||||
\\```
|
||||
\\ When looking at the resulting object, you can see the symbol is used verbatim:
|
||||
\\```zig
|
||||
\\
|
||||
\\00000000000001f0 T A function name that is a complete sentence.
|
||||
\\```
|
||||
},
|
||||
.{
|
||||
@ -543,8 +543,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@field",
|
||||
.signature = "@field(lhs: var, comptime field_name: []const u8) (field)",
|
||||
.snippet = "@field(${1:lhs: var}, ${2:comptime field_name: []const u8})",
|
||||
.signature = "@field(lhs: anytype, comptime field_name: []const u8) (field)",
|
||||
.snippet = "@field(${1:lhs: anytype}, ${2:comptime field_name: []const u8})",
|
||||
.documentation =
|
||||
\\Performs field access by a compile-time string.
|
||||
\\test.zig
|
||||
@ -557,14 +557,14 @@ pub const builtins = [_]Builtin{
|
||||
\\};
|
||||
\\
|
||||
\\test "field access by string" {
|
||||
\\ const assert = std.debug.assert;
|
||||
\\ const expect = std.testing.expect;
|
||||
\\ var p = Point {.x = 0, .y = 0};
|
||||
\\
|
||||
\\ @field(p, "x") = 4;
|
||||
\\ @field(p, "y") = @field(p, "x") + 1;
|
||||
\\
|
||||
\\ assert(@field(p, "x") == 4);
|
||||
\\ assert(@field(p, "y") == 5);
|
||||
\\ expect(@field(p, "x") == 4);
|
||||
\\ expect(@field(p, "y") == 5);
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
@ -583,15 +583,15 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@floatCast",
|
||||
.signature = "@floatCast(comptime DestType: type, value: var) DestType",
|
||||
.snippet = "@floatCast(${1:comptime DestType: type}, ${2:value: var})",
|
||||
.signature = "@floatCast(comptime DestType: type, value: anytype) DestType",
|
||||
.snippet = "@floatCast(${1:comptime DestType: type}, ${2:value: anytype})",
|
||||
.documentation =
|
||||
\\ Convert from one float type to another. This cast is safe, but may cause the numeric value to lose precision.
|
||||
},
|
||||
.{
|
||||
.name = "@floatToInt",
|
||||
.signature = "@floatToInt(comptime DestType: type, float: var) DestType",
|
||||
.snippet = "@floatToInt(${1:comptime DestType: type}, ${2:float: var})",
|
||||
.signature = "@floatToInt(comptime DestType: type, float: anytype) DestType",
|
||||
.snippet = "@floatToInt(${1:comptime DestType: type}, ${2:float: anytype})",
|
||||
.documentation =
|
||||
\\ Converts the integer part of a floating point number to the destination type.
|
||||
\\ If the integer part of the floating point number cannot fit in the destination type, it invokes safety-checked Undefined Behavior.
|
||||
@ -606,8 +606,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@Frame",
|
||||
.signature = "@Frame(func: var) type",
|
||||
.snippet = "@Frame(${1:func: var})",
|
||||
.signature = "@Frame(func: anytype) type",
|
||||
.snippet = "@Frame(${1:func: anytype})",
|
||||
.documentation =
|
||||
\\ This function returns the frame type of a function. This works for Async Functions as well as any function without a specific calling convention.
|
||||
\\ This type is suitable to be used as the return type of async which allows one to, for example, heap-allocate an async function frame:
|
||||
@ -657,7 +657,7 @@ pub const builtins = [_]Builtin{
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const assert = std.debug.assert;
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\const Foo = struct {
|
||||
\\ nope: i32,
|
||||
@ -667,16 +667,16 @@ pub const builtins = [_]Builtin{
|
||||
\\};
|
||||
\\
|
||||
\\test "@hasDecl" {
|
||||
\\ assert(@hasDecl(Foo, "blah"));
|
||||
\\ expect(@hasDecl(Foo, "blah"));
|
||||
\\
|
||||
\\ // Even though `hi` is private, @hasDecl returns true because this test is
|
||||
\\ // in the same file scope as Foo. It would return false if Foo was declared
|
||||
\\ // in a different file.
|
||||
\\ assert(@hasDecl(Foo, "hi"));
|
||||
\\ expect(@hasDecl(Foo, "hi"));
|
||||
\\
|
||||
\\ // @hasDecl is for declarations; not fields.
|
||||
\\ assert(!@hasDecl(Foo, "nope"));
|
||||
\\ assert(!@hasDecl(Foo, "nope1234"));
|
||||
\\ expect(!@hasDecl(Foo, "nope"));
|
||||
\\ expect(!@hasDecl(Foo, "nope1234"));
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
@ -703,13 +703,13 @@ pub const builtins = [_]Builtin{
|
||||
\\ This function finds a zig file corresponding to path and adds it to the build, if it is not already added.
|
||||
\\ Zig source files are implicitly structs, with a name equal to the file's basename with the extension truncated. @import returns the struct type corresponding to the file.
|
||||
\\ Declarations which have the pub keyword may be referenced from a different source file than the one they are declared in.
|
||||
\\ path can be a relative or absolute path, or it can be the name of a package. If it is a relative path, it is relative to the file that contains the @import function call.
|
||||
\\ path can be a relative path or it can be the name of a package. If it is a relative path, it is relative to the file that contains the @import function call.
|
||||
\\ The following packages are always available:
|
||||
},
|
||||
.{
|
||||
.name = "@intCast",
|
||||
.signature = "@intCast(comptime DestType: type, int: var) DestType",
|
||||
.snippet = "@intCast(${1:comptime DestType: type}, ${2:int: var})",
|
||||
.signature = "@intCast(comptime DestType: type, int: anytype) DestType",
|
||||
.snippet = "@intCast(${1:comptime DestType: type}, ${2:int: anytype})",
|
||||
.documentation =
|
||||
\\ Converts an integer to another integer while keeping the same numerical value. Attempting to convert a number which is out of range of the destination type results in safety-protected Undefined Behavior.
|
||||
\\ If T is comptime_int, then this is semantically equivalent to Type Coercion.
|
||||
@ -733,8 +733,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@intToFloat",
|
||||
.signature = "@intToFloat(comptime DestType: type, int: var) DestType",
|
||||
.snippet = "@intToFloat(${1:comptime DestType: type}, ${2:int: var})",
|
||||
.signature = "@intToFloat(comptime DestType: type, int: anytype) DestType",
|
||||
.snippet = "@intToFloat(${1:comptime DestType: type}, ${2:int: anytype})",
|
||||
.documentation =
|
||||
\\ Converts an integer to the closest floating point representation. To convert the other way, use @floatToInt. This cast is always safe.
|
||||
},
|
||||
@ -780,6 +780,42 @@ pub const builtins = [_]Builtin{
|
||||
\\mem.set(u8, dest, c);
|
||||
\\```
|
||||
},
|
||||
.{
|
||||
.name = "@wasmMemorySize",
|
||||
.signature = "@wasmMemorySize(index: u32) u32",
|
||||
.snippet = "@wasmMemorySize(${1:index: u32})",
|
||||
.documentation =
|
||||
\\ This function returns the size of the Wasm memory identified by index as an unsigned value in units of Wasm pages. Note that each Wasm page is 64KB in size.
|
||||
\\ This function is a low level intrinsic with no safety mechanisms usually useful for allocator designers targeting Wasm. So unless you are writing a new allocator from scratch, you should use something like @import("std").heap.WasmPageAllocator.
|
||||
},
|
||||
.{
|
||||
.name = "@wasmMemoryGrow",
|
||||
.signature = "@wasmMemoryGrow(index: u32, delta: u32) i32",
|
||||
.snippet = "@wasmMemoryGrow(${1:index: u32}, ${2:delta: u32})",
|
||||
.documentation =
|
||||
\\ This function increases the size of the Wasm memory identified by index by delta in units of unsigned number of Wasm pages. Note that each Wasm page is 64KB in size. On success, returns previous memory size; on failure, if the allocation fails, returns -1.
|
||||
\\ This function is a low level intrinsic with no safety mechanisms usually useful for allocator designers targeting Wasm. So unless you are writing a new allocator from scratch, you should use something like @import("std").heap.WasmPageAllocator.
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const builtin = @import("builtin");
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\test "@wasmMemoryGrow" {
|
||||
\\ if (builtin.arch != .wasm32) return error.SkipZigTest;
|
||||
\\
|
||||
\\ var prev = @wasmMemorySize(0);
|
||||
\\ expect(prev == @wasmMemoryGrow(0, 1));
|
||||
\\ expect(prev + 1 == @wasmMemorySize(0));
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
\\$ zig test test.zig
|
||||
\\1/1 test "@wasmMemoryGrow"... SKIP
|
||||
\\0 passed; 1 skipped.
|
||||
\\
|
||||
\\```
|
||||
},
|
||||
.{
|
||||
.name = "@mod",
|
||||
.signature = "@mod(numerator: T, denominator: T) T",
|
||||
@ -794,38 +830,6 @@ pub const builtins = [_]Builtin{
|
||||
.documentation =
|
||||
\\ Performs result.* = a * b. If overflow or underflow occurs, stores the overflowed bits in result and returns true. If no overflow or underflow occurs, returns false.
|
||||
},
|
||||
.{
|
||||
.name = "@OpaqueType",
|
||||
.signature = "@OpaqueType() type",
|
||||
.snippet = "@OpaqueType()",
|
||||
.documentation =
|
||||
\\ Creates a new type with an unknown (but non-zero) size and alignment.
|
||||
\\ This is typically used for type safety when interacting with C code that does not expose struct details. Example:
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const Derp = @OpaqueType();
|
||||
\\const Wat = @OpaqueType();
|
||||
\\
|
||||
\\extern fn bar(d: *Derp) void;
|
||||
\\fn foo(w: *Wat) callconv(.C) void {
|
||||
\\ bar(w);
|
||||
\\}
|
||||
\\
|
||||
\\test "call foo" {
|
||||
\\ foo(undefined);
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
\\$ zig test test.zig
|
||||
\\./docgen_tmp/test.zig:6:9: error: expected type '*Derp', found '*Wat'
|
||||
\\ bar(w);
|
||||
\\ ^
|
||||
\\./docgen_tmp/test.zig:6:9: note: pointer type child 'Wat' cannot cast into pointer type child 'Derp'
|
||||
\\ bar(w);
|
||||
\\ ^
|
||||
\\
|
||||
\\```
|
||||
},
|
||||
.{
|
||||
.name = "@panic",
|
||||
.signature = "@panic(message: []const u8) noreturn",
|
||||
@ -844,16 +848,16 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@ptrCast",
|
||||
.signature = "@ptrCast(comptime DestType: type, value: var) DestType",
|
||||
.snippet = "@ptrCast(${1:comptime DestType: type}, ${2:value: var})",
|
||||
.signature = "@ptrCast(comptime DestType: type, value: anytype) DestType",
|
||||
.snippet = "@ptrCast(${1:comptime DestType: type}, ${2:value: anytype})",
|
||||
.documentation =
|
||||
\\ Converts a pointer of one type to a pointer of another type.
|
||||
\\ Optional Pointers are allowed. Casting an optional pointer which is null to a non-optional pointer invokes safety-checked Undefined Behavior.
|
||||
},
|
||||
.{
|
||||
.name = "@ptrToInt",
|
||||
.signature = "@ptrToInt(value: var) usize",
|
||||
.snippet = "@ptrToInt(${1:value: var})",
|
||||
.signature = "@ptrToInt(value: anytype) usize",
|
||||
.snippet = "@ptrToInt(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Converts value to a usize which is the address of the pointer. value can be one of these types:
|
||||
},
|
||||
@ -976,11 +980,10 @@ pub const builtins = [_]Builtin{
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
\\$ zig test test.zig --release-fast
|
||||
\\$ zig test test.zig-OReleaseFast
|
||||
\\1/1 test "@setRuntimeSafety"... integer overflow
|
||||
\\
|
||||
\\Tests failed. Use the following command to reproduce the failure:
|
||||
\\/deps/zig/docgen_tmp/test
|
||||
\\error: the following test command crashed:
|
||||
\\docgen_tmp/zig-cache/o/cb6de32279940f36da16caa4f64d8c67/test
|
||||
\\
|
||||
\\```
|
||||
\\Note: it is planned to replace @setRuntimeSafety with @optimizeFor
|
||||
@ -1011,8 +1014,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@shuffle",
|
||||
.signature = "@shuffle(comptime E: type, a: @Vector(a_len, E), b: @Vector(b_len, E), comptime mask: @Vector(mask_len, i32)) @Vector(mask_len, E)",
|
||||
.snippet = "@shuffle(${1:comptime E: type}, ${2:a: @Vector(a_len, E)}, ${3:b: @Vector(b_len, E)}, ${4:comptime mask: @Vector(mask_len, i32)})",
|
||||
.signature = "@shuffle(comptime E: type, a: std.meta.Vector(a_len, E), b: std.meta.Vector(b_len, E), comptime mask: std.meta.Vector(mask_len, i32)) std.meta.Vector(mask_len, E)",
|
||||
.snippet = "@shuffle(${1:comptime E: type}, ${2:a: std.meta.Vector(a_len, E)}, ${3:b: std.meta.Vector(b_len, E)}, ${4:comptime mask: std.meta.Vector(mask_len, i32)})",
|
||||
.documentation =
|
||||
\\ Constructs a new vector by selecting elements from a and b based on mask.
|
||||
\\ Each element in mask selects an element from either a or b. Positive numbers select from a starting at 0. Negative values select from b, starting at -1 and going down. It is recommended to use the ~ operator from indexes from b so that both indexes can start from 0 (i.e. ~@as(i32, 0) is -1).
|
||||
@ -1032,20 +1035,20 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@splat",
|
||||
.signature = "@splat(comptime len: u32, scalar: var) @Vector(len, @TypeOf(scalar))",
|
||||
.snippet = "@splat(${1:comptime len: u32}, ${2:scalar: var})",
|
||||
.signature = "@splat(comptime len: u32, scalar: anytype) std.meta.Vector(len, @TypeOf(scalar))",
|
||||
.snippet = "@splat(${1:comptime len: u32}, ${2:scalar: anytype})",
|
||||
.documentation =
|
||||
\\ Produces a vector of length len where each element is the value scalar:
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const assert = std.debug.assert;
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\test "vector @splat" {
|
||||
\\ const scalar: u32 = 5;
|
||||
\\ const result = @splat(4, scalar);
|
||||
\\ comptime assert(@TypeOf(result) == @Vector(4, u32));
|
||||
\\ assert(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 }));
|
||||
\\ comptime expect(@TypeOf(result) == std.meta.Vector(4, u32));
|
||||
\\ expect(std.mem.eql(u32, &@as([4]u32, result), &[_]u32{ 5, 5, 5, 5 }));
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
@ -1056,106 +1059,145 @@ pub const builtins = [_]Builtin{
|
||||
\\```
|
||||
\\ scalar must be an integer, bool, float, or pointer.
|
||||
},
|
||||
.{
|
||||
.name = "@reduce",
|
||||
.signature = "@reduce(comptime op: builtin.ReduceOp, value: anytype) std.meta.Child(value)",
|
||||
.snippet = "@reduce(${1:comptime op: builtin.ReduceOp}, ${2:value: anytype})",
|
||||
.documentation =
|
||||
\\ Transforms a vector into a scalar value by performing a sequential horizontal reduction of its elements using the specified specified operator op.
|
||||
\\ Not every operator is available for every vector element type:
|
||||
},
|
||||
.{
|
||||
.name = "@src",
|
||||
.signature = "@src() std.builtin.SourceLocation",
|
||||
.snippet = "@src()",
|
||||
.documentation =
|
||||
\\ Returns a SourceLocation struct representing the function's name and location in the source code. This must be called in a function.
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\test "@src" {
|
||||
\\ doTheTest();
|
||||
\\}
|
||||
\\
|
||||
\\fn doTheTest() void {
|
||||
\\ const src = @src();
|
||||
\\
|
||||
\\ expect(src.line == 9);
|
||||
\\ expect(src.column == 17);
|
||||
\\ expect(std.mem.endsWith(u8, src.fn_name, "doTheTest"));
|
||||
\\ expect(std.mem.endsWith(u8, src.file, "test.zig"));
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
\\$ zig test test.zig
|
||||
\\1/1 test "@src"... OK
|
||||
\\All 1 tests passed.
|
||||
\\
|
||||
\\```
|
||||
},
|
||||
.{
|
||||
.name = "@sqrt",
|
||||
.signature = "@sqrt(value: var) @TypeOf(value)",
|
||||
.snippet = "@sqrt(${1:value: var})",
|
||||
.signature = "@sqrt(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@sqrt(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Performs the square root of a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@sin",
|
||||
.signature = "@sin(value: var) @TypeOf(value)",
|
||||
.snippet = "@sin(${1:value: var})",
|
||||
.signature = "@sin(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@sin(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Sine trigometric function on a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@cos",
|
||||
.signature = "@cos(value: var) @TypeOf(value)",
|
||||
.snippet = "@cos(${1:value: var})",
|
||||
.signature = "@cos(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@cos(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Cosine trigometric function on a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@exp",
|
||||
.signature = "@exp(value: var) @TypeOf(value)",
|
||||
.snippet = "@exp(${1:value: var})",
|
||||
.signature = "@exp(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@exp(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Base-e exponential function on a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@exp2",
|
||||
.signature = "@exp2(value: var) @TypeOf(value)",
|
||||
.snippet = "@exp2(${1:value: var})",
|
||||
.signature = "@exp2(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@exp2(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Base-2 exponential function on a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@log",
|
||||
.signature = "@log(value: var) @TypeOf(value)",
|
||||
.snippet = "@log(${1:value: var})",
|
||||
.signature = "@log(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@log(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Returns the natural logarithm of a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@log2",
|
||||
.signature = "@log2(value: var) @TypeOf(value)",
|
||||
.snippet = "@log2(${1:value: var})",
|
||||
.signature = "@log2(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@log2(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Returns the logarithm to the base 2 of a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@log10",
|
||||
.signature = "@log10(value: var) @TypeOf(value)",
|
||||
.snippet = "@log10(${1:value: var})",
|
||||
.signature = "@log10(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@log10(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Returns the logarithm to the base 10 of a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@fabs",
|
||||
.signature = "@fabs(value: var) @TypeOf(value)",
|
||||
.snippet = "@fabs(${1:value: var})",
|
||||
.signature = "@fabs(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@fabs(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Returns the absolute value of a floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@floor",
|
||||
.signature = "@floor(value: var) @TypeOf(value)",
|
||||
.snippet = "@floor(${1:value: var})",
|
||||
.signature = "@floor(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@floor(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Returns the largest integral value not greater than the given floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@ceil",
|
||||
.signature = "@ceil(value: var) @TypeOf(value)",
|
||||
.snippet = "@ceil(${1:value: var})",
|
||||
.signature = "@ceil(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@ceil(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Returns the largest integral value not less than the given floating point number. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@trunc",
|
||||
.signature = "@trunc(value: var) @TypeOf(value)",
|
||||
.snippet = "@trunc(${1:value: var})",
|
||||
.signature = "@trunc(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@trunc(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Rounds the given floating point number to an integer, towards zero. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
},
|
||||
.{
|
||||
.name = "@round",
|
||||
.signature = "@round(value: var) @TypeOf(value)",
|
||||
.snippet = "@round(${1:value: var})",
|
||||
.signature = "@round(value: anytype) @TypeOf(value)",
|
||||
.snippet = "@round(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Rounds the given floating point number to an integer, away from zero. Uses a dedicated hardware instruction when available.
|
||||
\\ Supports Floats and Vectors of floats, with the caveat that some float operations are not yet implemented for all float types.
|
||||
@ -1169,8 +1211,8 @@ pub const builtins = [_]Builtin{
|
||||
},
|
||||
.{
|
||||
.name = "@tagName",
|
||||
.signature = "@tagName(value: var) []const u8",
|
||||
.snippet = "@tagName(${1:value: var})",
|
||||
.signature = "@tagName(value: anytype) []const u8",
|
||||
.snippet = "@tagName(${1:value: anytype})",
|
||||
.documentation =
|
||||
\\ Converts an enum value or union value to a slice of bytes representing the name.
|
||||
\\If the enum is non-exhaustive and the tag value does not map to a name, it invokes safety-checked Undefined Behavior.
|
||||
@ -1188,16 +1230,16 @@ pub const builtins = [_]Builtin{
|
||||
.signature = "@This() type",
|
||||
.snippet = "@This()",
|
||||
.documentation =
|
||||
\\ Returns the innermost struct or union that this function call is inside. This can be useful for an anonymous struct that needs to refer to itself:
|
||||
\\ Returns the innermost struct, enum, or union that this function call is inside. This can be useful for an anonymous struct that needs to refer to itself:
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const assert = std.debug.assert;
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\test "@This()" {
|
||||
\\ var items = [_]i32{ 1, 2, 3, 4 };
|
||||
\\ const list = List(i32){ .items = items[0..] };
|
||||
\\ assert(list.length() == 4);
|
||||
\\ expect(list.length() == 4);
|
||||
\\}
|
||||
\\
|
||||
\\fn List(comptime T: type) type {
|
||||
@ -1218,12 +1260,12 @@ pub const builtins = [_]Builtin{
|
||||
\\All 1 tests passed.
|
||||
\\
|
||||
\\```
|
||||
\\ When @This() is used at global scope, it returns a reference to the current import. There is a proposal to remove the import type and use an empty struct type instead. See #1047 for details.
|
||||
\\ When @This() is used at global scope, it returns a reference to the struct that corresponds to the current file.
|
||||
},
|
||||
.{
|
||||
.name = "@truncate",
|
||||
.signature = "@truncate(comptime T: type, integer: var) T",
|
||||
.snippet = "@truncate(${1:comptime T: type}, ${2:integer: var})",
|
||||
.signature = "@truncate(comptime T: type, integer: anytype) T",
|
||||
.snippet = "@truncate(${1:comptime T: type}, ${2:integer: anytype})",
|
||||
.documentation =
|
||||
\\ This function truncates bits from an integer type, resulting in a smaller or same-sized integer type.
|
||||
\\ The following produces safety-checked Undefined Behavior:
|
||||
@ -1237,33 +1279,32 @@ pub const builtins = [_]Builtin{
|
||||
\\```zig
|
||||
\\$ zig test test.zig
|
||||
\\1/1 test "integer cast panic"... integer cast truncated bits
|
||||
\\/deps/zig/docgen_tmp/test.zig:3:17: 0x204bd5 in test "integer cast panic" (test)
|
||||
\\/home/andy/Downloads/zig/docgen_tmp/test.zig:3:17: 0x205995 in test "integer cast panic" (test)
|
||||
\\ var b: u8 = @intCast(u8, a);
|
||||
\\ ^
|
||||
\\/deps/zig/lib/std/special/test_runner.zig:47:28: 0x22bade in std.special.main (test)
|
||||
\\/home/andy/Downloads/zig/lib/std/special/test_runner.zig:61:28: 0x22d991 in std.special.main (test)
|
||||
\\ } else test_fn.func();
|
||||
\\ ^
|
||||
\\/deps/zig/lib/std/start.zig:253:37: 0x20560d in std.start.posixCallMainAndExit (test)
|
||||
\\/home/andy/Downloads/zig/lib/std/start.zig:334:37: 0x20729d in std.start.posixCallMainAndExit (test)
|
||||
\\ const result = root.main() catch |err| {
|
||||
\\ ^
|
||||
\\/deps/zig/lib/std/start.zig:123:5: 0x20534f in std.start._start (test)
|
||||
\\/home/andy/Downloads/zig/lib/std/start.zig:162:5: 0x206fd2 in std.start._start (test)
|
||||
\\ @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{});
|
||||
\\ ^
|
||||
\\
|
||||
\\Tests failed. Use the following command to reproduce the failure:
|
||||
\\/deps/zig/docgen_tmp/test
|
||||
\\error: the following test command crashed:
|
||||
\\docgen_tmp/zig-cache/o/2e7f715609483f0cd9100db66b70c1a0/test
|
||||
\\
|
||||
\\```
|
||||
\\ However this is well defined and working code:
|
||||
\\truncate.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const assert = std.debug.assert;
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\test "integer truncation" {
|
||||
\\ var a: u16 = 0xabcd;
|
||||
\\ var b: u8 = @truncate(u8, a);
|
||||
\\ assert(b == 0xcd);
|
||||
\\ expect(b == 0xcd);
|
||||
\\}
|
||||
\\```
|
||||
\\```zig
|
||||
@ -1307,13 +1348,13 @@ pub const builtins = [_]Builtin{
|
||||
\\test.zig
|
||||
\\```zig
|
||||
\\const std = @import("std");
|
||||
\\const assert = std.debug.assert;
|
||||
\\const expect = std.testing.expect;
|
||||
\\
|
||||
\\test "no runtime side effects" {
|
||||
\\ var data: i32 = 0;
|
||||
\\ const T = @TypeOf(foo(i32, &data));
|
||||
\\ comptime assert(T == i32);
|
||||
\\ assert(data == 0);
|
||||
\\ comptime expect(T == i32);
|
||||
\\ expect(data == 0);
|
||||
\\}
|
||||
\\
|
||||
\\fn foo(comptime T: type, ptr: *T) T {
|
||||
@ -1336,12 +1377,4 @@ pub const builtins = [_]Builtin{
|
||||
\\ This is the same thing as union initialization syntax, except that the field name is a comptime-known value rather than an identifier token.
|
||||
\\ @unionInit forwards its result location to init_expr.
|
||||
},
|
||||
.{
|
||||
.name = "@Vector",
|
||||
.signature = "@Vector(comptime len: u32, comptime ElemType: type) type",
|
||||
.snippet = "@Vector(${1:comptime len: u32}, ${2:comptime ElemType: type})",
|
||||
.documentation =
|
||||
\\ This function returns a vector type for SIMD.
|
||||
\\ ElemType must be an integer, a float, or a pointer.
|
||||
},
|
||||
};
|
@ -478,7 +478,7 @@ pub const builtins = [_]Builtin{
|
||||
.signature = "@errorReturnTrace() ?*builtin.StackTrace",
|
||||
.snippet = "@errorReturnTrace()",
|
||||
.documentation =
|
||||
\\ 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 stack trace object. Otherwise returns `null`.
|
||||
\\ 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 stack trace object. Otherwise returns null.
|
||||
},
|
||||
.{
|
||||
.name = "@errorToInt",
|
||||
@ -983,7 +983,7 @@ pub const builtins = [_]Builtin{
|
||||
\\$ zig test test.zig-OReleaseFast
|
||||
\\1/1 test "@setRuntimeSafety"... integer overflow
|
||||
\\error: the following test command crashed:
|
||||
\\docgen_tmp/zig-cache/o/6f85d27aeec8f22ea7b8c42d6973fa33/test
|
||||
\\docgen_tmp/zig-cache/o/1dd5b9d2eb0c824ad8bb3cab3c173811/test
|
||||
\\
|
||||
\\```
|
||||
\\Note: it is planned to replace @setRuntimeSafety with @optimizeFor
|
||||
@ -1064,7 +1064,7 @@ pub const builtins = [_]Builtin{
|
||||
.signature = "@reduce(comptime op: builtin.ReduceOp, value: anytype) std.meta.Child(value)",
|
||||
.snippet = "@reduce(${1:comptime op: builtin.ReduceOp}, ${2:value: anytype})",
|
||||
.documentation =
|
||||
\\ Transforms a vector into a scalar value by performing a sequential horizontal reduction of its elements using the specified specified operator op.
|
||||
\\ Transforms a vector into a scalar value by performing a sequential horizontal reduction of its elements using the specified operator op.
|
||||
\\ Not every operator is available for every vector element type:
|
||||
},
|
||||
.{
|
||||
@ -1292,7 +1292,7 @@ pub const builtins = [_]Builtin{
|
||||
\\ @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{});
|
||||
\\ ^
|
||||
\\error: the following test command crashed:
|
||||
\\docgen_tmp/zig-cache/o/0b574a8ca6a652386eca64b0fe91aeee/test
|
||||
\\docgen_tmp/zig-cache/o/0ac59203e6cc7c69be59cafa47214a9f/test
|
||||
\\
|
||||
\\```
|
||||
\\ However this is well defined and working code:
|
||||
|
Loading…
Reference in New Issue
Block a user