Update builtins from master docs

This commit is contained in:
SuperAuguste 2020-07-25 14:52:31 -04:00
parent 8d376a077c
commit fdba27b6e0
No known key found for this signature in database
GPG Key ID: BBBFB75D16C221FD

View File

@ -2,14 +2,14 @@
/// Builtin functions
pub const builtins = [_][]const u8{"@addWithOverflow(${1:comptime T: type}, ${2:a: T}, ${3:b: T}, ${4:result: *T})",
"@alignCast(${1:comptime alignment: u29}, ${2:ptr: var})",
"@alignCast(${1:comptime alignment: u29}, ${2:ptr: anytype})",
"@alignOf(${1:comptime T: type})",
"@as(${1:comptime T: type}, ${2:expression})",
"@asyncCall(${1:frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8}, ${2:result_ptr}, ${3:function_ptr}, ${4:args: ...})",
"@asyncCall(${1:frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8}, ${2:result_ptr}, ${3:function_ptr}, ${4:args: anytype})",
"@atomicLoad(${1:comptime T: type}, ${2:ptr: *const T}, ${3:comptime ordering: builtin.AtomicOrder})",
"@atomicRmw(${1:comptime T: type}, ${2:ptr: *T}, ${3:comptime op: builtin.AtomicRmwOp}, ${4:operand: T}, ${5:comptime ordering: builtin.AtomicOrder})",
"@atomicStore(${1:comptime T: type}, ${2:ptr: *T}, ${3:value: T}, ${4:comptime ordering: builtin.AtomicOrder})",
"@bitCast(${1:comptime DestType: type}, ${2:value: var})",
"@bitCast(${1:comptime DestType: type}, ${2:value: anytype})",
"@bitOffsetOf(${1:comptime T: type}, ${2:comptime field_name: []const u8})",
"@boolToInt(${1:value: bool})",
"@bitSizeOf(${1:comptime T: type})",
@ -18,7 +18,7 @@ pub const builtins = [_][]const u8{"@addWithOverflow(${1:comptime T: type}, ${2:
"@byteSwap(${1:comptime T: type}, ${2:operand: T})",
"@bitReverse(${1:comptime T: type}, ${2:integer: T})",
"@byteOffsetOf(${1:comptime T: type}, ${2:comptime field_name: []const u8})",
"@call(${1:options: std.builtin.CallOptions}, ${2:function: var}, ${3:args: var})",
"@call(${1:options: std.builtin.CallOptions}, ${2:function: anytype}, ${3:args: anytype})",
"@cDefine(${1:comptime name: []u8}, ${2:value})",
"@cImport(${1:expression})",
"@cInclude(${1:comptime path: []u8})",
@ -33,37 +33,39 @@ pub const builtins = [_][]const u8{"@addWithOverflow(${1:comptime T: type}, ${2:
"@divFloor(${1:numerator: T}, ${2:denominator: T})",
"@divTrunc(${1:numerator: T}, ${2:denominator: T})",
"@embedFile(${1:comptime path: []const u8})",
"@enumToInt(${1:enum_or_tagged_union: var})",
"@enumToInt(${1:enum_or_tagged_union: anytype})",
"@errorName(${1:err: anyerror})",
"@errorReturnTrace()",
"@errorToInt(${1:err: var) std.meta.IntType(false}, ${2:@sizeOf(anyerror})",
"@errSetCast(${1:comptime T: DestType}, ${2:value: var})",
"@export(${1:target: var}, ${2:comptime options: std.builtin.ExportOptions})",
"@errorToInt(${1:err: anytype) std.meta.IntType(false}, ${2:@sizeOf(anyerror})",
"@errSetCast(${1:comptime T: DestType}, ${2:value: anytype})",
"@export(${1:target: anytype}, ${2:comptime options: std.builtin.ExportOptions})",
"@fence(${1:order: AtomicOrder})",
"@field(${1:lhs: var}, ${2:comptime field_name: []const u8})",
"@field(${1:lhs: anytype}, ${2:comptime field_name: []const u8})",
"@fieldParentPtr(${1:comptime ParentType: type}, ${2:comptime field_name: []const u8}, ${3:\n field_ptr: *T})",
"@floatCast(${1:comptime DestType: type}, ${2:value: var})",
"@floatToInt(${1:comptime DestType: type}, ${2:float: var})",
"@floatCast(${1:comptime DestType: type}, ${2:value: anytype})",
"@floatToInt(${1:comptime DestType: type}, ${2:float: anytype})",
"@frame()",
"@Frame(${1:func: var})",
"@Frame(${1:func: anytype})",
"@frameAddress()",
"@frameSize()",
"@hasDecl(${1:comptime Container: type}, ${2:comptime name: []const u8})",
"@hasField(${1:comptime Container: type}, ${2:comptime name: []const u8})",
"@import(${1:comptime path: []u8})",
"@intCast(${1:comptime DestType: type}, ${2:int: var})",
"@intCast(${1:comptime DestType: type}, ${2:int: anytype})",
"@intToEnum(${1:comptime DestType: type}, ${2:int_value: @TagType(DestType)})",
"@intToError(${1:value: std.meta.IntType(false, @sizeOf(anyerror) * 8)})",
"@intToFloat(${1:comptime DestType: type}, ${2:int: var})",
"@intToFloat(${1:comptime DestType: type}, ${2:int: anytype})",
"@intToPtr(${1:comptime DestType: type}, ${2:address: usize})",
"@memcpy(${1:noalias dest: [*]u8}, ${2:noalias source: [*]const u8}, ${3:byte_count: usize})",
"@memset(${1:dest: [*]u8}, ${2:c: u8}, ${3:byte_count: usize})",
"@wasmMemorySize(${1:index: u32})",
"@wasmMemoryGrow(${1:index: u32}, ${2:delta: u32})",
"@mod(${1:numerator: T}, ${2:denominator: T})",
"@mulWithOverflow(${1:comptime T: type}, ${2:a: T}, ${3:b: T}, ${4:result: *T})",
"@panic(${1:message: []const u8})",
"@popCount(${1:comptime T: type}, ${2:integer: T})",
"@ptrCast(${1:comptime DestType: type}, ${2:value: var})",
"@ptrToInt(${1:value: var})",
"@ptrCast(${1:comptime DestType: type}, ${2:value: anytype})",
"@ptrToInt(${1:value: anytype})",
"@rem(${1:numerator: T}, ${2:denominator: T})",
"@returnAddress()",
"@setAlignStack(${1:comptime alignment: u29})",
@ -76,25 +78,26 @@ pub const builtins = [_][]const u8{"@addWithOverflow(${1:comptime T: type}, ${2:
"@shrExact(${1:value: T}, ${2:shift_amt: Log2T})",
"@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)})",
"@sizeOf(${1:comptime T: type})",
"@splat(${1:comptime len: u32}, ${2:scalar: var})",
"@sqrt(${1:value: var})",
"@sin(${1:value: var})",
"@cos(${1:value: var})",
"@exp(${1:value: var})",
"@exp2(${1:value: var})",
"@log(${1:value: var})",
"@log2(${1:value: var})",
"@log10(${1:value: var})",
"@fabs(${1:value: var})",
"@floor(${1:value: var})",
"@ceil(${1:value: var})",
"@trunc(${1:value: var})",
"@round(${1:value: var})",
"@splat(${1:comptime len: u32}, ${2:scalar: anytype})",
"@src()",
"@sqrt(${1:value: anytype})",
"@sin(${1:value: anytype})",
"@cos(${1:value: anytype})",
"@exp(${1:value: anytype})",
"@exp2(${1:value: anytype})",
"@log(${1:value: anytype})",
"@log2(${1:value: anytype})",
"@log10(${1:value: anytype})",
"@fabs(${1:value: anytype})",
"@floor(${1:value: anytype})",
"@ceil(${1:value: anytype})",
"@trunc(${1:value: anytype})",
"@round(${1:value: anytype})",
"@subWithOverflow(${1:comptime T: type}, ${2:a: T}, ${3:b: T}, ${4:result: *T})",
"@tagName(${1:value: var})",
"@tagName(${1:value: anytype})",
"@TagType(${1:T: type})",
"@This()",
"@truncate(${1:comptime T: type}, ${2:integer: var})",
"@truncate(${1:comptime T: type}, ${2:integer: anytype})",
"@Type(${1:comptime info: @import(\"builtin\").TypeInfo})",
"@typeInfo(${1:comptime T: type})",
"@typeName(${1:T: type})",
@ -103,14 +106,14 @@ pub const builtins = [_][]const u8{"@addWithOverflow(${1:comptime T: type}, ${2:
/// Builtin function details
pub const builtin_details = [_][]const u8{"@addWithOverflow(comptime T: type, a: T, b: T, result: *T) bool",
"@alignCast(comptime alignment: u29, ptr: var) var",
"@alignCast(comptime alignment: u29, ptr: anytype) anytype",
"@alignOf(comptime T: type) comptime_int",
"@as(comptime T: type, expression) T",
"@asyncCall(frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8, result_ptr, function_ptr, args: ...) anyframe->T",
"@asyncCall(frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8, result_ptr, function_ptr, args: anytype) anyframe->T",
"@atomicLoad(comptime T: type, ptr: *const T, comptime ordering: builtin.AtomicOrder) T",
"@atomicRmw(comptime T: type, ptr: *T, comptime op: builtin.AtomicRmwOp, operand: T, comptime ordering: builtin.AtomicOrder) T",
"@atomicStore(comptime T: type, ptr: *T, value: T, comptime ordering: builtin.AtomicOrder) void",
"@bitCast(comptime DestType: type, value: var) DestType",
"@bitCast(comptime DestType: type, value: anytype) DestType",
"@bitOffsetOf(comptime T: type, comptime field_name: []const u8) comptime_int",
"@boolToInt(value: bool) u1",
"@bitSizeOf(comptime T: type) comptime_int",
@ -119,7 +122,7 @@ pub const builtin_details = [_][]const u8{"@addWithOverflow(comptime T: type, a:
"@byteSwap(comptime T: type, operand: T) T",
"@bitReverse(comptime T: type, integer: T) T",
"@byteOffsetOf(comptime T: type, comptime field_name: []const u8) comptime_int",
"@call(options: std.builtin.CallOptions, function: var, args: var) var",
"@call(options: std.builtin.CallOptions, function: anytype, args: anytype) anytype",
"@cDefine(comptime name: []u8, value)",
"@cImport(expression) type",
"@cInclude(comptime path: []u8)",
@ -134,37 +137,39 @@ pub const builtin_details = [_][]const u8{"@addWithOverflow(comptime T: type, a:
"@divFloor(numerator: T, denominator: T) T",
"@divTrunc(numerator: T, denominator: T) T",
"@embedFile(comptime path: []const u8) *const [X:0]u8",
"@enumToInt(enum_or_tagged_union: var) var",
"@enumToInt(enum_or_tagged_union: anytype) anytype",
"@errorName(err: anyerror) []const u8",
"@errorReturnTrace() ?*builtin.StackTrace",
"@errorToInt(err: var) std.meta.IntType(false, @sizeOf(anyerror) * 8)",
"@errSetCast(comptime T: DestType, value: var) DestType",
"@export(target: var, comptime options: std.builtin.ExportOptions) void",
"@errorToInt(err: anytype) std.meta.IntType(false, @sizeOf(anyerror) * 8)",
"@errSetCast(comptime T: DestType, value: anytype) DestType",
"@export(target: anytype, comptime options: std.builtin.ExportOptions) void",
"@fence(order: AtomicOrder)",
"@field(lhs: var, comptime field_name: []const u8) (field)",
"@field(lhs: anytype, comptime field_name: []const u8) (field)",
"@fieldParentPtr(comptime ParentType: type, comptime field_name: []const u8,\n field_ptr: *T) *ParentType",
"@floatCast(comptime DestType: type, value: var) DestType",
"@floatToInt(comptime DestType: type, float: var) DestType",
"@floatCast(comptime DestType: type, value: anytype) DestType",
"@floatToInt(comptime DestType: type, float: anytype) DestType",
"@frame() *@Frame(func)",
"@Frame(func: var) type",
"@Frame(func: anytype) type",
"@frameAddress() usize",
"@frameSize() usize",
"@hasDecl(comptime Container: type, comptime name: []const u8) bool",
"@hasField(comptime Container: type, comptime name: []const u8) bool",
"@import(comptime path: []u8) type",
"@intCast(comptime DestType: type, int: var) DestType",
"@intCast(comptime DestType: type, int: anytype) DestType",
"@intToEnum(comptime DestType: type, int_value: @TagType(DestType)) DestType",
"@intToError(value: std.meta.IntType(false, @sizeOf(anyerror) * 8)) anyerror",
"@intToFloat(comptime DestType: type, int: var) DestType",
"@intToFloat(comptime DestType: type, int: anytype) DestType",
"@intToPtr(comptime DestType: type, address: usize) DestType",
"@memcpy(noalias dest: [*]u8, noalias source: [*]const u8, byte_count: usize)",
"@memset(dest: [*]u8, c: u8, byte_count: usize)",
"@wasmMemorySize(index: u32) u32",
"@wasmMemoryGrow(index: u32, delta: u32) i32",
"@mod(numerator: T, denominator: T) T",
"@mulWithOverflow(comptime T: type, a: T, b: T, result: *T) bool",
"@panic(message: []const u8) noreturn",
"@popCount(comptime T: type, integer: T)",
"@ptrCast(comptime DestType: type, value: var) DestType",
"@ptrToInt(value: var) usize",
"@ptrCast(comptime DestType: type, value: anytype) DestType",
"@ptrToInt(value: anytype) usize",
"@rem(numerator: T, denominator: T) T",
"@returnAddress() usize",
"@setAlignStack(comptime alignment: u29)",
@ -177,25 +182,26 @@ pub const builtin_details = [_][]const u8{"@addWithOverflow(comptime T: type, a:
"@shrExact(value: T, shift_amt: Log2T) T",
"@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)",
"@sizeOf(comptime T: type) comptime_int",
"@splat(comptime len: u32, scalar: var) std.meta.Vector(len, @TypeOf(scalar))",
"@sqrt(value: var) @TypeOf(value)",
"@sin(value: var) @TypeOf(value)",
"@cos(value: var) @TypeOf(value)",
"@exp(value: var) @TypeOf(value)",
"@exp2(value: var) @TypeOf(value)",
"@log(value: var) @TypeOf(value)",
"@log2(value: var) @TypeOf(value)",
"@log10(value: var) @TypeOf(value)",
"@fabs(value: var) @TypeOf(value)",
"@floor(value: var) @TypeOf(value)",
"@ceil(value: var) @TypeOf(value)",
"@trunc(value: var) @TypeOf(value)",
"@round(value: var) @TypeOf(value)",
"@splat(comptime len: u32, scalar: anytype) std.meta.Vector(len, @TypeOf(scalar))",
"@src() std.builtin.SourceLocation",
"@sqrt(value: anytype) @TypeOf(value)",
"@sin(value: anytype) @TypeOf(value)",
"@cos(value: anytype) @TypeOf(value)",
"@exp(value: anytype) @TypeOf(value)",
"@exp2(value: anytype) @TypeOf(value)",
"@log(value: anytype) @TypeOf(value)",
"@log2(value: anytype) @TypeOf(value)",
"@log10(value: anytype) @TypeOf(value)",
"@fabs(value: anytype) @TypeOf(value)",
"@floor(value: anytype) @TypeOf(value)",
"@ceil(value: anytype) @TypeOf(value)",
"@trunc(value: anytype) @TypeOf(value)",
"@round(value: anytype) @TypeOf(value)",
"@subWithOverflow(comptime T: type, a: T, b: T, result: *T) bool",
"@tagName(value: var) []const u8",
"@tagName(value: anytype) []const u8",
"@TagType(T: type) type",
"@This() type",
"@truncate(comptime T: type, integer: var) T",
"@truncate(comptime T: type, integer: anytype) T",
"@Type(comptime info: @import(\"builtin\").TypeInfo) type",
"@typeInfo(comptime T: type) @import(\"std\").builtin.TypeInfo",
"@typeName(T: type) [N]u8",
@ -260,6 +266,8 @@ pub const builtin_docs = [_][]const u8{"Performs result.* = a + b. If overflow o
"Converts an integer to a pointer. To convert the other way, use @ptrToInt.",
"This function copies bytes from one region of memory to another. dest and source are both pointers and must not overlap.",
"This function sets a region of memory to c. dest is a pointer.",
"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 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.",
"Modulus division. For unsigned integers this is the same as numerator % denominator. Caller guarantees denominator > 0.",
"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.",
"Invokes the panic handler function. By default the panic handler function calls the public panic function exposed in the root source file, or if there is not one specified, the std.builtin.default_panic function from std/builtin.zig.",
@ -279,6 +287,7 @@ pub const builtin_docs = [_][]const u8{"Performs result.* = a + b. If overflow o
"Constructs a new vector by selecting elements from a and b based on mask.",
"This function returns the number of bytes it takes to store T in memory. The result is a target-specific compile time constant.",
"Produces a vector of length len where each element is the value scalar:",
"Returns a SourceLocation struct representing the function's name and location in the source code. This must be called in a function.",
"Performs the square root of a floating point number. Uses a dedicated hardware instruction when available.",
"Sine trigometric function on a floating point number. Uses a dedicated hardware instruction when available.",
"Cosine trigometric function on a floating point number. Uses a dedicated hardware instruction when available.",
@ -295,7 +304,7 @@ pub const builtin_docs = [_][]const u8{"Performs result.* = a + b. If overflow o
"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.",
"Converts an enum value or union value to a slice of bytes representing the name.",
"For an enum, returns the integer type that is used to store the enumeration value.",
"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:",
"This function truncates bits from an integer type, resulting in a smaller or same-sized integer type.",
"This function is the inverse of @typeInfo. It reifies type information into a type.",
"Provides type reflection.",