diff --git a/build.zig b/build.zig index 8ebedc5b5e124d965f1d0ae889ecdde579ac529a..30a82d84f3ee47d4fdd881222c2d8274b8bedaa2 100644 --- a/build.zig +++ b/build.zig @@ -191,7 +191,7 @@ pub fn build(b: *std.Build) !void { const valgrind = b.option(bool, "valgrind", "Enable valgrind integration"); const pie = b.option(bool, "pie", "Produce a Position Independent Executable"); const io_mode = b.option(IoMode, "io-mode", "How the compiler performs IO") orelse .threaded; - const value_interpret_mode = b.option(ValueInterpretMode, "value-interpret-mode", "How the compiler translates between 'std.builtin' types and its internal datastructures") orelse .direct; + const value_interpret_mode = b.option(ValueInterpretMode, "value-interpret-mode", "How the compiler translates between 'std.lang' types and its internal datastructures") orelse .direct; const value_tracing = b.option(bool, "value-tracing", "Enable extra state tracking to help troubleshoot bugs in the compiler (using the std.debug.Trace API)") orelse false; const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: { diff --git a/lib/std/zig.zig b/lib/std/zig.zig index bf9a6ed94db578ffbf27eb8ec4ce8898597e82ad..75ef9c9b63195335b78c5cfa04d4d75742532905 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -876,7 +876,7 @@ pub const SimpleComptimeReason = enum(u32) { casted_to_comptime_enum, casted_to_comptime_int, casted_to_comptime_float, - std_builtin_decl, + std_lang_decl, pub fn message(r: SimpleComptimeReason) []const u8 { return switch (r) { @@ -959,7 +959,7 @@ pub const SimpleComptimeReason = enum(u32) { .casted_to_comptime_enum => "value casted to enum with 'comptime_int' tag type must be comptime-known", .casted_to_comptime_int => "value casted to 'comptime_int' must be comptime-known", .casted_to_comptime_float => "value casted to 'comptime_float' must be comptime-known", - .std_builtin_decl => "'std.builtin' declaration values must be comptime-known", + .std_lang_decl => "'std.lang' declaration values must be comptime-known", // zig fmt: on }; } diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index 307bedd15615ea571b9fbaceb58c9e2dd8e0733e..58711d5471b7b3a1f75c3bcd7017150b74ac1dac 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -1398,12 +1398,12 @@ fn fnProtoExprInner( try comptimeExpr( &block_scope, scope, - .{ .rl = .{ .coerced_ty = try block_scope.addBuiltinValue(callconv_expr, .calling_convention) } }, + .{ .rl = .{ .coerced_ty = try block_scope.addStdLangValue(callconv_expr, .calling_convention) } }, callconv_expr, .@"callconv", ) else if (implicit_ccc) - try block_scope.addBuiltinValue(node, .calling_convention_c) + try block_scope.addStdLangValue(node, .calling_convention_c) else .none; @@ -3782,7 +3782,7 @@ fn ptrType( gz.astgen.source_line = source_line; gz.astgen.source_column = source_column; - const addrspace_ty = try gz.addBuiltinValue(addrspace_node, .address_space); + const addrspace_ty = try gz.addStdLangValue(addrspace_node, .address_space); addrspace_ref = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = addrspace_ty } }, addrspace_node, .@"addrspace"); trailing_count += 1; } @@ -4077,7 +4077,7 @@ fn fnDecl( if (fn_proto.ast.addrspace_expr.unwrap()) |addrspace_expr| { astgen.restoreSourceCursor(saved_cursor); - const addrspace_ty = try addrspace_gz.addBuiltinValue(addrspace_expr, .address_space); + const addrspace_ty = try addrspace_gz.addStdLangValue(addrspace_expr, .address_space); const inst = try expr(&addrspace_gz, &addrspace_gz.base, .{ .rl = .{ .coerced_ty = addrspace_ty } }, addrspace_expr); _ = try addrspace_gz.addBreakWithSrcNode(.break_inline, decl_inst, inst, decl_node); } @@ -4285,7 +4285,7 @@ fn fnDeclInner( const inst = try expr( &cc_gz, scope, - .{ .rl = .{ .coerced_ty = try cc_gz.addBuiltinValue(callconv_expr, .calling_convention) } }, + .{ .rl = .{ .coerced_ty = try cc_gz.addStdLangValue(callconv_expr, .calling_convention) } }, callconv_expr, ); if (cc_gz.instructionsSlice().len == 0) { @@ -4295,7 +4295,7 @@ fn fnDeclInner( _ = try cc_gz.addBreak(.break_inline, @enumFromInt(0), inst); break :blk inst; } else if (has_inline_keyword) { - const inst = try cc_gz.addBuiltinValue(decl_node, .calling_convention_inline); + const inst = try cc_gz.addStdLangValue(decl_node, .calling_convention_inline); _ = try cc_gz.addBreak(.break_inline, @enumFromInt(0), inst); break :blk inst; } else { @@ -4493,7 +4493,7 @@ fn globalVarDecl( defer addrspace_gz.unstack(); if (var_decl.ast.addrspace_node.unwrap()) |addrspace_node| { - const addrspace_ty = try addrspace_gz.addBuiltinValue(addrspace_node, .address_space); + const addrspace_ty = try addrspace_gz.addStdLangValue(addrspace_node, .address_space); const addrspace_inst = try expr(&addrspace_gz, &addrspace_gz.base, .{ .rl = .{ .coerced_ty = addrspace_ty } }, addrspace_node); _ = try addrspace_gz.addBreakWithSrcNode(.break_inline, decl_inst, addrspace_inst, node); } @@ -8650,7 +8650,7 @@ fn asmExpr( const clobbers: Zir.Inst.Ref = if (full.ast.clobbers.unwrap()) |clobbers_node| try comptimeExpr(gz, scope, .{ .rl = .{ - .coerced_ty = try gz.addBuiltinValue(clobbers_node, .clobbers), + .coerced_ty = try gz.addStdLangValue(clobbers_node, .clobbers), } }, clobbers_node, .clobber) else .none; @@ -8992,7 +8992,7 @@ fn builtinCall( if (!allow_branch_hint) { return astgen.failNode(node, "'@branchHint' must appear as the first statement in a function or conditional branch", .{}); } - const hint_ty = try gz.addBuiltinValue(node, .branch_hint); + const hint_ty = try gz.addStdLangValue(node, .branch_hint); const hint_val = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = hint_ty } }, params[0], .operand_branchHint); _ = try gz.addExtendedPayload(.branch_hint, Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(node), @@ -9090,7 +9090,7 @@ fn builtinCall( .@"export" => { const exported = try expr(gz, scope, .{ .rl = .none }, params[0]); - const export_options_ty = try gz.addBuiltinValue(node, .export_options); + const export_options_ty = try gz.addStdLangValue(node, .export_options); const options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = export_options_ty } }, params[1], .export_options); _ = try gz.addPlNode(.@"export", node, Zir.Inst.Export{ .exported = exported, @@ -9100,7 +9100,7 @@ fn builtinCall( }, .@"extern" => { const type_inst = try typeExpr(gz, scope, params[0]); - const extern_options_ty = try gz.addBuiltinValue(node, .extern_options); + const extern_options_ty = try gz.addStdLangValue(node, .extern_options); const options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = extern_options_ty } }, params[1], .extern_options); const result = try gz.addExtendedPayload(.builtin_extern, Zir.Inst.BinNode{ .node = gz.nodeIndexToRelative(node), @@ -9110,7 +9110,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .set_float_mode => { - const float_mode_ty = try gz.addBuiltinValue(node, .float_mode); + const float_mode_ty = try gz.addStdLangValue(node, .float_mode); const order = try expr(gz, scope, .{ .rl = .{ .coerced_ty = float_mode_ty } }, params[0]); _ = try gz.addExtendedPayload(.set_float_mode, Zir.Inst.UnNode{ .node = gz.nodeIndexToRelative(node), @@ -9196,7 +9196,7 @@ fn builtinCall( .EnumLiteral => return rvalue(gz, ri, .enum_literal_type, node), .Int => { - const signedness_ty = try gz.addBuiltinValue(node, .signedness); + const signedness_ty = try gz.addStdLangValue(node, .signedness); const result = try gz.addPlNode(.reify_int, node, Zir.Inst.Bin{ .lhs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = signedness_ty } }, params[0], .int_signedness), .rhs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .u16_type } }, params[1], .int_bit_width), @@ -9211,8 +9211,8 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Pointer => { - const ptr_size_ty = try gz.addBuiltinValue(node, .pointer_size); - const ptr_attrs_ty = try gz.addBuiltinValue(node, .pointer_attributes); + const ptr_size_ty = try gz.addStdLangValue(node, .pointer_size); + const ptr_attrs_ty = try gz.addStdLangValue(node, .pointer_attributes); const size = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = ptr_size_ty } }, params[0], .pointer_size); const attrs = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = ptr_attrs_ty } }, params[1], .pointer_attrs); const elem_ty = try typeExpr(gz, scope, params[2]); @@ -9231,7 +9231,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Fn => { - const fn_attrs_ty = try gz.addBuiltinValue(node, .fn_attributes); + const fn_attrs_ty = try gz.addStdLangValue(node, .fn_attributes); const param_types = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_type_type } }, params[0], .fn_param_types); const param_attrs_ty = try gz.addExtendedPayloadSmall( .reify_slice_arg_ty, @@ -9251,7 +9251,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Struct => { - const container_layout_ty = try gz.addBuiltinValue(node, .container_layout); + const container_layout_ty = try gz.addStdLangValue(node, .container_layout); const layout = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = container_layout_ty } }, params[0], .struct_layout); const backing_ty = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .optional_type_type } }, params[1], .type); const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .struct_field_names); @@ -9279,7 +9279,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Union => { - const container_layout_ty = try gz.addBuiltinValue(node, .container_layout); + const container_layout_ty = try gz.addStdLangValue(node, .container_layout); const layout = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = container_layout_ty } }, params[0], .union_layout); const arg_ty = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .optional_type_type } }, params[1], .type); const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .union_field_names); @@ -9307,7 +9307,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .Enum => { - const enum_mode_ty = try gz.addBuiltinValue(node, .enum_mode); + const enum_mode_ty = try gz.addStdLangValue(node, .enum_mode); const tag_ty = try typeExpr(gz, scope, params[0]); const mode = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = enum_mode_ty } }, params[1], .type); const field_names = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_slice_const_u8_type } }, params[2], .enum_field_names); @@ -9425,7 +9425,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .reduce => { - const reduce_op_ty = try gz.addBuiltinValue(node, .reduce_op); + const reduce_op_ty = try gz.addStdLangValue(node, .reduce_op); const op = try expr(gz, scope, .{ .rl = .{ .coerced_ty = reduce_op_ty } }, params[0]); const scalar = try expr(gz, scope, .{ .rl = .none }, params[1]); const result = try gz.addPlNode(.reduce, node, Zir.Inst.Bin{ @@ -9441,7 +9441,7 @@ fn builtinCall( .shl_with_overflow => return overflowArithmetic(gz, scope, ri, node, params, .shl_with_overflow), .atomic_load => { - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); const result = try gz.addPlNode(.atomic_load, node, Zir.Inst.AtomicLoad{ // zig fmt: off .elem_type = try typeExpr(gz, scope, params[0]), @@ -9452,8 +9452,8 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .atomic_rmw => { - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); - const atomic_rmw_op_type = try gz.addBuiltinValue(node, .atomic_rmw_op); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); + const atomic_rmw_op_type = try gz.addStdLangValue(node, .atomic_rmw_op); const int_type = try typeExpr(gz, scope, params[0]); const result = try gz.addPlNode(.atomic_rmw, node, Zir.Inst.AtomicRmw{ // zig fmt: off @@ -9466,7 +9466,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .atomic_store => { - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); const int_type = try typeExpr(gz, scope, params[0]); _ = try gz.addPlNode(.atomic_store, node, Zir.Inst.AtomicStore{ // zig fmt: off @@ -9490,7 +9490,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .call => { - const call_modifier_ty = try gz.addBuiltinValue(node, .call_modifier); + const call_modifier_ty = try gz.addStdLangValue(node, .call_modifier); const modifier = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = call_modifier_ty } }, params[0], .call_modifier); const callee = try expr(gz, scope, .{ .rl = .none }, params[1]); const args = try expr(gz, scope, .{ .rl = .none }, params[2]); @@ -9567,7 +9567,7 @@ fn builtinCall( return rvalue(gz, ri, result, node); }, .prefetch => { - const prefetch_options_ty = try gz.addBuiltinValue(node, .prefetch_options); + const prefetch_options_ty = try gz.addStdLangValue(node, .prefetch_options); const ptr = try expr(gz, scope, .{ .rl = .none }, params[0]); const options = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = prefetch_options_ty } }, params[1], .prefetch_options); _ = try gz.addExtendedPayload(.prefetch, Zir.Inst.BinNode{ @@ -9800,7 +9800,7 @@ fn cmpxchg( small: u16, ) InnerError!Zir.Inst.Ref { const int_type = try typeExpr(gz, scope, params[0]); - const atomic_order_type = try gz.addBuiltinValue(node, .atomic_order); + const atomic_order_type = try gz.addStdLangValue(node, .atomic_order); const result = try gz.addExtendedPayloadSmall(.cmpxchg, small, Zir.Inst.Cmpxchg{ // zig fmt: off .node = gz.nodeIndexToRelative(node), @@ -11801,8 +11801,8 @@ const GenZir = struct { return new_index; } - fn addBuiltinValue(gz: *GenZir, src_node: Ast.Node.Index, val: Zir.Inst.BuiltinValue) !Zir.Inst.Ref { - return addExtendedNodeSmall(gz, .builtin_value, src_node, @intFromEnum(val)); + fn addStdLangValue(gz: *GenZir, src_node: Ast.Node.Index, val: Zir.Inst.StdLangValue) !Zir.Inst.Ref { + return addExtendedNodeSmall(gz, .std_lang_value, src_node, @intFromEnum(val)); } fn addExtendedPayload(gz: *GenZir, opcode: Zir.Inst.Extended, extra: anytype) !Zir.Inst.Ref { diff --git a/lib/std/zig/Zir.zig b/lib/std/zig/Zir.zig index 5e5fd924bdbde9fab07d89b076c9f1ff96b34116..f8af9688ae7857a4050b29ace18a89ba171e1f45 100644 --- a/lib/std/zig/Zir.zig +++ b/lib/std/zig/Zir.zig @@ -2119,10 +2119,10 @@ pub const Inst = struct { /// Guaranteed to not have the `ptr_cast` flag. /// Uses the `pl_node` union field with payload `FieldParentPtr`. field_parent_ptr, - /// Get a type or value from `std.builtin`. + /// Get a type or value from `std.lang`. /// `operand` is `src_node: Ast.Node.Offset`. - /// `small` is an `Inst.BuiltinValue`. - builtin_value, + /// `small` is an `Inst.StdLangValue`. + std_lang_value, /// Provide a `@branchHint` for the current block. /// `operand` is payload index to `UnNode`. /// `small` is unused. @@ -3564,7 +3564,7 @@ pub const Inst = struct { } }; - pub const BuiltinValue = enum(u16) { + pub const StdLangValue = enum(u16) { // Types atomic_order, atomic_rmw_op, @@ -4368,7 +4368,7 @@ fn findTrackableInner( .restore_err_ret_index, .closure_get, .field_parent_ptr, - .builtin_value, + .std_lang_value, .branch_hint, .inplace_arith_result_ty, .tuple_decl, diff --git a/src/Air.zig b/src/Air.zig index ec53a6175edf19245ff22da060a77d78f1b39b8b..78086f567f5f5556d6541edf9ddd63d83dd2d193 100644 --- a/src/Air.zig +++ b/src/Air.zig @@ -1481,7 +1481,7 @@ pub const Asm = struct { /// Length of the assembly source in bytes. source_len: u32, inputs_len: u32, - /// A comptime `std.builtin.assembly.Clobbers` value for the target architecture. + /// A comptime `std.lang.assembly.Clobbers` value for the target architecture. clobbers: InternPool.Index, flags: Flags, diff --git a/src/Air/Legalize.zig b/src/Air/Legalize.zig index 65c943742972138acc61c1c9b3062ef8119720e9..e449835ce856ac7061f07abe33329fc4963f4fcf 100644 --- a/src/Air/Legalize.zig +++ b/src/Air/Legalize.zig @@ -2644,7 +2644,7 @@ const Block = struct { }); return; } - const panic_fn_val = zcu.builtin_decl_values.get(panic_id.toBuiltin()); + const panic_fn_val = zcu.std_lang_decl_values.get(panic_id.toStdLangDecl()); _ = b.add(l, .{ .tag = .call, .data = .{ .pl_op = .{ diff --git a/src/Builtin.zig b/src/Builtin.zig index 92a0e40ae3fe71696e29d01b569381e5dd292fa6..f8cf9a38508c60587590f7d4375293771fa6e7af 100644 --- a/src/Builtin.zig +++ b/src/Builtin.zig @@ -57,11 +57,11 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro \\/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks. \\pub const zig_version = std.SemanticVersion.parse(zig_version_string) catch unreachable; \\pub const zig_version_string = "{s}"; - \\pub const zig_backend = std.builtin.CompilerBackend.{f}; + \\pub const zig_backend = std.lang.CompilerBackend.{f}; \\ - \\pub const output_mode: std.builtin.OutputMode = .{f}; - \\pub const link_mode: std.builtin.LinkMode = .{f}; - \\pub const unwind_tables: std.builtin.UnwindTables = .{f}; + \\pub const output_mode: std.lang.OutputMode = .{f}; + \\pub const link_mode: std.lang.LinkMode = .{f}; + \\pub const unwind_tables: std.lang.UnwindTables = .{f}; \\pub const is_test = {}; \\pub const single_threaded = {}; \\pub const abi: std.Target.Abi = .{f}; @@ -239,7 +239,7 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro try buffer.print( \\pub const object_format: std.Target.ObjectFormat = .{f}; - \\pub const mode: std.builtin.OptimizeMode = .{f}; + \\pub const mode: std.lang.OptimizeMode = .{f}; \\pub const link_libc = {}; \\pub const link_libcpp = {}; \\pub const have_error_return_tracing = {}; @@ -249,7 +249,7 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro \\pub const position_independent_code = {}; \\pub const position_independent_executable = {}; \\pub const strip_debug_info = {}; - \\pub const code_model: std.builtin.CodeModel = .{f}; + \\pub const code_model: std.lang.CodeModel = .{f}; \\pub const omit_frame_pointer = {}; \\ , .{ @@ -270,14 +270,14 @@ pub fn append(opts: @This(), buffer: *std.array_list.Managed(u8)) Allocator.Erro if (target.os.tag == .wasi) { try buffer.print( - \\pub const wasi_exec_model: std.builtin.WasiExecModel = .{f}; + \\pub const wasi_exec_model: std.lang.WasiExecModel = .{f}; \\ , .{std.zig.fmtIdPU(@tagName(opts.wasi_exec_model))}); } if (opts.is_test) { try buffer.appendSlice( - \\pub var test_functions: []const std.builtin.TestFn = &.{}; // overwritten later + \\pub var test_functions: []const std.lang.TestFn = &.{}; // overwritten later \\ ); } diff --git a/src/InternPool.zig b/src/InternPool.zig index 7471fa78f674dcde3d4b080b2e7b42c696151749..29be84b0036d595fc34ba4f1a1b150eb29d106d0 100644 --- a/src/InternPool.zig +++ b/src/InternPool.zig @@ -486,12 +486,12 @@ pub const AnalUnit = packed struct(u64) { pub const MemoizedStateStage = enum(u32) { /// Everything other than panics and `VaList`. main, - /// Everything within `std.builtin.Panic`. + /// Everything within `std.lang.Panic`. /// Since the panic handler is user-provided, this must be able to reference the other memoized state. panic, - /// Specifically `std.builtin.VaList`. See `Zcu.BuiltinDecl.stage`. + /// Specifically `std.lang.VaList`. See `Zcu.StdLangDecl.stage`. va_list, - /// Everything within `std.builtin.assembly`. See `Zcu.BuiltinDecl.stage`. + /// Everything within `std.lang.assembly`. See `Zcu.StdLangDecl.stage`. assembly, }; diff --git a/src/Sema.zig b/src/Sema.zig index c3abfcd422e84002153603b71c3ad7e927fc73cb..217216162009f0bbdeca2f56a7d4299be30d88f3 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1473,7 +1473,7 @@ fn analyzeBodyInner( }, .value_placeholder => unreachable, // never appears in a body .field_parent_ptr => try sema.zirFieldParentPtr(block, extended), - .builtin_value => try sema.zirBuiltinValue(block, extended), + .std_lang_value => try sema.zirStdLangValue(block, extended), .inplace_arith_result_ty => try sema.zirInplaceArithResultTy(extended), .dbg_empty_stmt => { try sema.zirDbgEmptyStmt(block, inst); @@ -2225,7 +2225,7 @@ pub fn setupErrorReturnTrace(sema: *Sema, block: *Block, last_arg_index: usize) const addrs_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(addr_arr_ty)); // var st: StackTrace = undefined; - const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace); + const stack_trace_ty = try sema.getStdLangType(block.nodeOffset(.zero), .StackTrace); const st_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(stack_trace_ty)); // st.instruction_addresses = &addrs; @@ -2805,10 +2805,10 @@ fn analyzeValueAsCallconv( src: LazySrcLoc, val: Value, ) !std.builtin.CallingConvention { - return interpretBuiltinType(sema, block, src, val, std.builtin.CallingConvention); + return interpretStdLangType(sema, block, src, val, std.builtin.CallingConvention); } -fn interpretBuiltinType( +fn interpretStdLangType( sema: *Sema, block: *Block, src: LazySrcLoc, @@ -2818,7 +2818,7 @@ fn interpretBuiltinType( return val.interpret(T, sema.pt) catch |err| switch (err) { error.OutOfMemory => |e| return e, error.UndefinedValue => return sema.failWithUseOfUndef(block, src, null), - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), }; } @@ -5074,7 +5074,7 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void } try sema.ensureMemoizedStateResolved(src, .panic); - const panic_fn_index = zcu.builtin_decl_values.get(.@"panic.call"); + const panic_fn_index = zcu.std_lang_decl_values.get(.@"panic.call"); const opt_usize_ty = try pt.optionalType(.usize_type); const null_ret_addr = Air.internedToRef((try pt.intern(.{ .opt = .{ .ty = opt_usize_ty.toIntern(), @@ -5692,7 +5692,7 @@ fn zirDisableIntrinsics(sema: *Sema) CompileError!void { fn zirSetFloatMode(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!void { const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; const src = block.builtinCallArgSrc(extra.node, 0); - block.float_mode = try sema.resolveBuiltinEnum(block, src, extra.operand, .FloatMode, .{ .simple = .operand_setFloatMode }); + block.float_mode = try sema.resolveStdLangEnum(block, src, extra.operand, .FloatMode, .{ .simple = .operand_setFloatMode }); } fn zirSetRuntimeSafety(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { @@ -6008,10 +6008,10 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref if (!block.ownerModule().error_tracing) return .none; - const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace); + const stack_trace_ty = try sema.getStdLangType(block.nodeOffset(.zero), .StackTrace); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); const field_index = sema.structFieldIndex(block, stack_trace_ty, field_name, LazySrcLoc.unneeded) catch |err| switch (err) { - error.AnalysisFail => @panic("std.builtin.StackTrace is corrupt"), + error.AnalysisFail => @panic("std.lang.StackTrace is corrupt"), error.ComptimeReturn, error.ComptimeBreak => unreachable, error.OutOfMemory, error.Canceled => |e| return e, }; @@ -6051,7 +6051,7 @@ fn popErrorReturnTrace( // AstGen determined this result does not go to an error-handling expr (try/catch/return etc.), or // the result is comptime-known to be a non-error. Either way, pop unconditionally. - const stack_trace_ty = try sema.getBuiltinType(src, .StackTrace); + const stack_trace_ty = try sema.getStdLangType(src, .StackTrace); const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty); const err_return_trace = try block.addTy(.err_return_trace, ptr_stack_trace_ty); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); @@ -6076,7 +6076,7 @@ fn popErrorReturnTrace( defer then_block.instructions.deinit(gpa); // If non-error, then pop the error return trace by restoring the index. - const stack_trace_ty = try sema.getBuiltinType(src, .StackTrace); + const stack_trace_ty = try sema.getStdLangType(src, .StackTrace); const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty); const err_return_trace = try then_block.addTy(.err_return_trace, ptr_stack_trace_ty); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); @@ -6215,7 +6215,7 @@ fn zirCall( // If any input is an error-type, we might need to pop any trace it generated. Otherwise, we only // need to clean-up our own trace if we were passed to a non-error-handling expression. if (input_is_error or (pop_error_return_trace and return_ty.isError(zcu))) { - const stack_trace_ty = try sema.getBuiltinType(call_src, .StackTrace); + const stack_trace_ty = try sema.getStdLangType(call_src, .StackTrace); const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls); const field_index = try sema.structFieldIndex(block, stack_trace_ty, field_name, call_src); @@ -8377,10 +8377,10 @@ fn zirFunc( if (fn_is_exported) { break :cc target.cCallingConvention() orelse { // This target has no default C calling convention. We sometimes trigger a similar - // error by trying to evaluate `std.builtin.CallingConvention.c`, so for consistency, + // error by trying to evaluate `std.lang.CallingConvention.c`, so for consistency, // let's eval that now and just get the transitive error. (It's guaranteed to error // because it does the exact `cCallingConvention` call we just did.) - const cc_type = try sema.getBuiltinType(src, .CallingConvention); + const cc_type = try sema.getStdLangType(src, .CallingConvention); _ = try sema.namespaceLookupVal( block, LazySrcLoc.unneeded, @@ -8388,7 +8388,7 @@ fn zirFunc( try ip.getOrPutString(gpa, io, pt.tid, "c", .no_embedded_nulls), ); // The above should have errored. - @panic("std.builtin is corrupt"); + @panic("std.lang is corrupt"); }; } else { break :cc .auto; @@ -12711,7 +12711,7 @@ fn maybeErrorUnwrap( const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; const msg_inst = sema.resolveInst(inst_data.operand); - const panic_fn = try getBuiltin(sema, operand_src, .@"panic.call"); + const panic_fn = try getStdLangValue(sema, operand_src, .@"panic.call"); const args: [2]Air.Inst.Ref = .{ msg_inst, .null_value }; try sema.callBuiltin(block, operand_src, Air.internedToRef(panic_fn), .auto, &args, .@"safety check"); return true; @@ -15319,7 +15319,7 @@ fn zirAsm( } const clobbers_src = block.src(.{ .asm_clobbers = src.offset.node_offset.x }); - const clobbers_ty = try sema.getBuiltinType(src, .@"assembly.Clobbers"); + const clobbers_ty = try sema.getStdLangType(src, .@"assembly.Clobbers"); const clobbers = if (extra.data.clobbers == .none) empty: { break :empty try sema.structInitEmpty(block, clobbers_ty, src, src); } else clobbers: { @@ -15930,7 +15930,7 @@ fn zirBuiltinSrc( } }); }; - const src_loc_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .SourceLocation); + const src_loc_ty = try sema.getStdLangType(block.nodeOffset(.zero), .SourceLocation); const fields = .{ // module: [:0]const u8, module_name_val, @@ -15957,7 +15957,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node; const src = block.nodeOffset(inst_data.src_node); const ty = try sema.resolveType(block, src, inst_data.operand); - const type_info_ty = try sema.getBuiltinType(src, .Type); + const type_info_ty = try sema.getStdLangType(src, .Type); const type_info_tag_ty = type_info_ty.unionTagType(zcu).?; try sema.ensureLayoutResolved(ty, src, .type_info); @@ -15979,15 +15979,15 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai => |type_info_tag| return .fromValue(try pt.unionValue( type_info_ty, Value.uninterpret(type_info_tag, type_info_tag_ty, pt) catch |err| switch (err) { - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), error.OutOfMemory => |e| return e, }, .void, )), .@"fn" => { - const fn_info_ty = try sema.getBuiltinType(src, .@"Type.Fn"); - const param_info_ty = try sema.getBuiltinType(src, .@"Type.Fn.Param"); + const fn_info_ty = try sema.getStdLangType(src, .@"Type.Fn"); + const param_info_ty = try sema.getStdLangType(src, .@"Type.Fn.Param"); const func_ty_info = zcu.typeToFunc(ty).?; const param_vals = try sema.arena.alloc(InternPool.Index, func_ty_info.param_types.len); @@ -16068,9 +16068,9 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai .val = if (ret_ty_is_generic) .none else func_ty_info.return_type, } }); - const callconv_ty = try sema.getBuiltinType(src, .CallingConvention); + const callconv_ty = try sema.getStdLangType(src, .CallingConvention); const callconv_val = Value.uninterpret(func_ty_info.cc, callconv_ty, pt) catch |err| switch (err) { - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), error.OutOfMemory => |e| return e, }; @@ -16093,8 +16093,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .int => { - const int_info_ty = try sema.getBuiltinType(src, .@"Type.Int"); - const signedness_ty = try sema.getBuiltinType(src, .Signedness); + const int_info_ty = try sema.getStdLangType(src, .@"Type.Int"); + const signedness_ty = try sema.getStdLangType(src, .Signedness); const info = ty.intInfo(zcu); const field_values = .{ // signedness: Signedness, @@ -16109,7 +16109,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .float => { - const float_info_ty = try sema.getBuiltinType(src, .@"Type.Float"); + const float_info_ty = try sema.getStdLangType(src, .@"Type.Float"); const field_vals = .{ // bits: u16, @@ -16135,9 +16135,9 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai } })); }; - const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace); - const pointer_ty = try sema.getBuiltinType(src, .@"Type.Pointer"); - const ptr_size_ty = try sema.getBuiltinType(src, .@"Type.Pointer.Size"); + const addrspace_ty = try sema.getStdLangType(src, .AddressSpace); + const pointer_ty = try sema.getStdLangType(src, .@"Type.Pointer"); + const ptr_size_ty = try sema.getStdLangType(src, .@"Type.Pointer.Size"); const field_values = .{ // size: Size, @@ -16167,7 +16167,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .array => { - const array_field_ty = try sema.getBuiltinType(src, .@"Type.Array"); + const array_field_ty = try sema.getStdLangType(src, .@"Type.Array"); const info = ty.arrayInfo(zcu); const field_values = .{ @@ -16185,7 +16185,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .vector => { - const vector_field_ty = try sema.getBuiltinType(src, .@"Type.Vector"); + const vector_field_ty = try sema.getStdLangType(src, .@"Type.Vector"); const info = ty.arrayInfo(zcu); const field_values = .{ @@ -16201,7 +16201,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .optional => { - const optional_field_ty = try sema.getBuiltinType(src, .@"Type.Optional"); + const optional_field_ty = try sema.getStdLangType(src, .@"Type.Optional"); const field_values = .{ // child: type, @@ -16215,7 +16215,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }, .error_set => { // Get the Error type - const error_field_ty = try sema.getBuiltinType(src, .@"Type.Error"); + const error_field_ty = try sema.getStdLangType(src, .@"Type.Error"); // Build our list of Error values // Optional value is only null if anyerror @@ -16305,7 +16305,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .error_union => { - const error_union_field_ty = try sema.getBuiltinType(src, .@"Type.ErrorUnion"); + const error_union_field_ty = try sema.getStdLangType(src, .@"Type.ErrorUnion"); const field_values = .{ // error_set: type, @@ -16323,7 +16323,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const enum_obj = ip.loadEnumType(ty.toIntern()); const is_exhaustive: Value = .makeBool(!enum_obj.nonexhaustive); - const enum_field_ty = try sema.getBuiltinType(src, .@"Type.EnumField"); + const enum_field_ty = try sema.getStdLangType(src, .@"Type.EnumField"); const enum_field_vals = try sema.arena.alloc(InternPool.Index, enum_obj.field_names.len); for (enum_field_vals, 0..) |*field_val, tag_index| { @@ -16404,7 +16404,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const decls_val = try sema.typeInfoDecls(src, ip.loadEnumType(ty.toIntern()).namespace.toOptional()); - const type_enum_ty = try sema.getBuiltinType(src, .@"Type.Enum"); + const type_enum_ty = try sema.getStdLangType(src, .@"Type.Enum"); const field_values = .{ // tag_type: type, @@ -16423,8 +16423,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .@"union" => { - const type_union_ty = try sema.getBuiltinType(src, .@"Type.Union"); - const union_field_ty = try sema.getBuiltinType(src, .@"Type.UnionField"); + const type_union_ty = try sema.getStdLangType(src, .@"Type.Union"); + const union_field_ty = try sema.getStdLangType(src, .@"Type.UnionField"); const union_obj = ip.loadUnionType(ty.toIntern()); const enum_obj = ip.loadEnumType(union_obj.enum_tag_type); @@ -16524,7 +16524,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai .val = if (ty.unionTagType(zcu)) |tag_ty| tag_ty.toIntern() else .none, } }); - const container_layout_ty = try sema.getBuiltinType(src, .@"Type.ContainerLayout"); + const container_layout_ty = try sema.getStdLangType(src, .@"Type.ContainerLayout"); const field_values = .{ // layout: ContainerLayout, @@ -16544,8 +16544,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .@"struct" => { - const type_struct_ty = try sema.getBuiltinType(src, .@"Type.Struct"); - const struct_field_ty = try sema.getBuiltinType(src, .@"Type.StructField"); + const type_struct_ty = try sema.getStdLangType(src, .@"Type.Struct"); + const struct_field_ty = try sema.getStdLangType(src, .@"Type.StructField"); var struct_field_vals: []InternPool.Index = &.{}; defer gpa.free(struct_field_vals); @@ -16713,7 +16713,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai } else .none, } }); - const container_layout_ty = try sema.getBuiltinType(src, .@"Type.ContainerLayout"); + const container_layout_ty = try sema.getStdLangType(src, .@"Type.ContainerLayout"); const layout = ty.containerLayout(zcu); @@ -16736,7 +16736,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai }))); }, .@"opaque" => { - const type_opaque_ty = try sema.getBuiltinType(src, .@"Type.Opaque"); + const type_opaque_ty = try sema.getStdLangType(src, .@"Type.Opaque"); const decls_val = try sema.typeInfoDecls(src, ty.getNamespace(zcu)); @@ -16764,7 +16764,7 @@ fn typeInfoDecls( const zcu = pt.zcu; const gpa = sema.gpa; - const declaration_ty = try sema.getBuiltinType(src, .@"Type.Declaration"); + const declaration_ty = try sema.getStdLangType(src, .@"Type.Declaration"); var decl_vals = std.array_list.Managed(InternPool.Index).init(gpa); defer decl_vals.deinit(); @@ -17714,7 +17714,7 @@ fn maybePushErrorTrace( assert(pt.zcu.intern_pool.funcAnalysisUnordered(sema.owner.unwrap().func).has_error_trace); const gpa = sema.gpa; - const return_err_fn = Air.internedToRef(try sema.getBuiltin(src, .returnError)); + const return_err_fn = Air.internedToRef(try sema.getStdLangValue(src, .returnError)); if (!need_check) { try sema.callBuiltin(parent_block, src, return_err_fn, .never_tail, &.{}, .@"error return"); @@ -19179,7 +19179,7 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref { const pt = sema.pt; const zcu = pt.zcu; const ip = &zcu.intern_pool; - const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace); + const stack_trace_ty = try sema.getStdLangType(block.nodeOffset(.zero), .StackTrace); const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty); const opt_ptr_stack_trace_ty = try pt.optionalType(ptr_stack_trace_ty.toIntern()); @@ -19446,7 +19446,7 @@ fn zirReifyInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai const signedness_src = block.builtinCallArgSrc(inst_data.src_node, 0); const bits_src = block.builtinCallArgSrc(inst_data.src_node, 1); const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; - const signedness = try sema.resolveBuiltinEnum(block, signedness_src, extra.lhs, .Signedness, .{ .simple = .int_signedness }); + const signedness = try sema.resolveStdLangEnum(block, signedness_src, extra.lhs, .Signedness, .{ .simple = .int_signedness }); const bits: u16 = @intCast(try sema.resolveInt(block, bits_src, extra.rhs, .u16, .{ .simple = .int_bit_width })); if (bits == 0 and signedness == .signed) { return sema.fail(block, bits_src, "signed integer cannot have bit width 0", .{}); @@ -19469,11 +19469,11 @@ fn zirReifySliceArgTy( const comptime_reason: std.zig.SimpleComptimeReason, const in_scalar_ty: Type, const out_scalar_ty: Type = switch (info) { // zig fmt: off - .type_to_fn_param_attrs => .{ .fn_param_attrs, .type, try sema.getBuiltinType(src, .@"Type.Fn.Param.Attributes") }, + .type_to_fn_param_attrs => .{ .fn_param_attrs, .type, try sema.getStdLangType(src, .@"Type.Fn.Param.Attributes") }, .string_to_struct_field_type => .{ .struct_field_types, .slice_const_u8, .type }, .string_to_union_field_type => .{ .union_field_types, .slice_const_u8, .type }, - .string_to_struct_field_attrs => .{ .struct_field_attrs, .slice_const_u8, try sema.getBuiltinType(src, .@"Type.StructField.Attributes") }, - .string_to_union_field_attrs => .{ .union_field_attrs, .slice_const_u8, try sema.getBuiltinType(src, .@"Type.UnionField.Attributes") }, + .string_to_struct_field_attrs => .{ .struct_field_attrs, .slice_const_u8, try sema.getStdLangType(src, .@"Type.StructField.Attributes") }, + .string_to_union_field_attrs => .{ .union_field_attrs, .slice_const_u8, try sema.getStdLangType(src, .@"Type.UnionField.Attributes") }, // zig fmt: on }; @@ -19599,18 +19599,18 @@ fn zirReifyPointer( const elem_ty_src = block.builtinCallArgSrc(extra.node, 2); const sentinel_src = block.builtinCallArgSrc(extra.node, 3); - const size_ty = try sema.getBuiltinType(size_src, .@"Type.Pointer.Size"); - const attrs_ty = try sema.getBuiltinType(attrs_src, .@"Type.Pointer.Attributes"); + const size_ty = try sema.getStdLangType(size_src, .@"Type.Pointer.Size"); + const attrs_ty = try sema.getStdLangType(attrs_src, .@"Type.Pointer.Attributes"); const size_uncoerced = sema.resolveInst(extra.size); const size_coerced = try sema.coerce(block, size_ty, size_uncoerced, size_src); const size_val = try sema.resolveConstDefinedValue(block, size_src, size_coerced, .{ .simple = .pointer_size }); - const size = try sema.interpretBuiltinType(block, size_src, size_val, std.builtin.Type.Pointer.Size); + const size = try sema.interpretStdLangType(block, size_src, size_val, std.builtin.Type.Pointer.Size); const attrs_uncoerced = sema.resolveInst(extra.attrs); const attrs_coerced = try sema.coerce(block, attrs_ty, attrs_uncoerced, attrs_src); const attrs_val = try sema.resolveConstDefinedValue(block, attrs_src, attrs_coerced, .{ .simple = .pointer_attrs }); - const attrs = try sema.interpretBuiltinType(block, attrs_src, attrs_val, std.builtin.Type.Pointer.Attributes); + const attrs = try sema.interpretStdLangType(block, attrs_src, attrs_val, std.builtin.Type.Pointer.Attributes); const @"align": Alignment = if (attrs.@"align") |bytes| a: { break :a try sema.validateAlign(block, attrs_src, bytes); @@ -19687,8 +19687,8 @@ fn zirReifyFn( const ret_ty_src = block.builtinCallArgSrc(extra.node, 2); const fn_attrs_src = block.builtinCallArgSrc(extra.node, 3); - const single_param_attrs_ty = try sema.getBuiltinType(param_attrs_src, .@"Type.Fn.Param.Attributes"); - const fn_attrs_ty = try sema.getBuiltinType(fn_attrs_src, .@"Type.Fn.Attributes"); + const single_param_attrs_ty = try sema.getStdLangType(param_attrs_src, .@"Type.Fn.Param.Attributes"); + const fn_attrs_ty = try sema.getStdLangType(fn_attrs_src, .@"Type.Fn.Attributes"); const param_types_uncoerced = sema.resolveInst(extra.param_types); const param_types_coerced = try sema.coerce(block, .slice_const_type, param_types_uncoerced, param_types_src); @@ -19711,13 +19711,13 @@ fn zirReifyFn( const fn_attrs_uncoerced = sema.resolveInst(extra.fn_attrs); const fn_attrs_coerced = try sema.coerce(block, fn_attrs_ty, fn_attrs_uncoerced, fn_attrs_src); const fn_attrs_val = try sema.resolveConstDefinedValue(block, fn_attrs_src, fn_attrs_coerced, .{ .simple = .fn_attrs }); - const fn_attrs = try sema.interpretBuiltinType(block, fn_attrs_src, fn_attrs_val, std.builtin.Type.Fn.Attributes); + const fn_attrs = try sema.interpretStdLangType(block, fn_attrs_src, fn_attrs_val, std.builtin.Type.Fn.Attributes); var noalias_bits: u32 = 0; const param_types_ip = try sema.arena.alloc(InternPool.Index, @intCast(params_len)); for (param_types_ip, 0..@intCast(params_len)) |*param_ty_ip, param_idx| { const param_ty: Type = (try param_types_arr.elemValue(pt, param_idx)).toType(); - const param_attrs = try sema.interpretBuiltinType( + const param_attrs = try sema.interpretStdLangType( block, param_attrs_src, try param_attrs_arr.elemValue(pt, param_idx), @@ -19825,13 +19825,13 @@ fn zirReifyStruct( } }, }; - const container_layout_ty = try sema.getBuiltinType(layout_src, .@"Type.ContainerLayout"); - const single_field_attrs_ty = try sema.getBuiltinType(field_attrs_src, .@"Type.StructField.Attributes"); + const container_layout_ty = try sema.getStdLangType(layout_src, .@"Type.ContainerLayout"); + const single_field_attrs_ty = try sema.getStdLangType(field_attrs_src, .@"Type.StructField.Attributes"); const layout_uncoerced = sema.resolveInst(extra.layout); const layout_coerced = try sema.coerce(block, container_layout_ty, layout_uncoerced, layout_src); const layout_val = try sema.resolveConstDefinedValue(block, layout_src, layout_coerced, .{ .simple = .struct_layout }); - const layout = try sema.interpretBuiltinType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); + const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); const backing_int_ty_uncoerced = sema.resolveInst(extra.backing_ty); const backing_int_ty_coerced = try sema.coerce(block, .optional_type, backing_int_ty_uncoerced, backing_ty_src); @@ -20105,13 +20105,13 @@ fn zirReifyUnion( } }, }; - const container_layout_ty = try sema.getBuiltinType(layout_src, .@"Type.ContainerLayout"); - const single_field_attrs_ty = try sema.getBuiltinType(field_attrs_src, .@"Type.UnionField.Attributes"); + const container_layout_ty = try sema.getStdLangType(layout_src, .@"Type.ContainerLayout"); + const single_field_attrs_ty = try sema.getStdLangType(field_attrs_src, .@"Type.UnionField.Attributes"); const layout_uncoerced = sema.resolveInst(extra.layout); const layout_coerced = try sema.coerce(block, container_layout_ty, layout_uncoerced, layout_src); const layout_val = try sema.resolveConstDefinedValue(block, layout_src, layout_coerced, .{ .simple = .union_layout }); - const layout = try sema.interpretBuiltinType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); + const layout = try sema.interpretStdLangType(block, layout_src, layout_val, std.builtin.Type.ContainerLayout); const arg_ty_uncoerced = sema.resolveInst(extra.arg_ty); const arg_ty_coerced = try sema.coerce(block, .optional_type, arg_ty_uncoerced, arg_ty_src); @@ -20191,7 +20191,7 @@ fn zirReifyUnion( const field_name = try sema.sliceToIpString(block, field_names_src, field_name_val, .{ .simple = .union_field_names }); std.hash.autoHash(&hasher, field_name); - const field_attrs = try sema.interpretBuiltinType( + const field_attrs = try sema.interpretStdLangType( block, field_attrs_src, try field_attrs_arr.elemValue(pt, field_idx), @@ -20240,7 +20240,7 @@ fn zirReifyUnion( wip.field_types.get(ip)[field_idx] = field_ty.toIntern(); // No source location; first loop checked this is valid. - const field_attrs = try sema.interpretBuiltinType( + const field_attrs = try sema.interpretStdLangType( block, .unneeded, try field_attrs_arr.elemValue(pt, field_idx), @@ -20319,7 +20319,7 @@ fn zirReifyEnum( } }, }; - const enum_mode_ty = try sema.getBuiltinType(mode_src, .@"Type.Enum.Mode"); + const enum_mode_ty = try sema.getStdLangType(mode_src, .@"Type.Enum.Mode"); const tag_ty_uncoerced = sema.resolveInst(extra.tag_ty); const tag_ty_coerced = try sema.coerce(block, .type, tag_ty_uncoerced, tag_ty_src); @@ -20329,7 +20329,7 @@ fn zirReifyEnum( const mode_uncoerced = sema.resolveInst(extra.mode); const mode_coerced = try sema.coerce(block, enum_mode_ty, mode_uncoerced, mode_src); const mode_val = try sema.resolveConstDefinedValue(block, mode_src, mode_coerced, .{ .simple = .type }); - const nonexhaustive = switch (try sema.interpretBuiltinType(block, mode_src, mode_val, std.builtin.Type.Enum.Mode)) { + const nonexhaustive = switch (try sema.interpretStdLangType(block, mode_src, mode_val, std.builtin.Type.Enum.Mode)) { .exhaustive => false, .nonexhaustive => true, }; @@ -20423,7 +20423,7 @@ fn zirReifyEnum( fn resolveVaListRef(sema: *Sema, block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref) CompileError!Air.Inst.Ref { const pt = sema.pt; - const va_list_ty = try sema.getBuiltinType(src, .VaList); + const va_list_ty = try sema.getStdLangType(src, .VaList); const va_list_ptr = try pt.singleMutPtrType(va_list_ty); const inst = sema.resolveInst(zir_ref); @@ -20462,7 +20462,7 @@ fn zirCVaCopy(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) const va_list_src = block.builtinCallArgSrc(extra.node, 0); const va_list_ref = try sema.resolveVaListRef(block, va_list_src, extra.operand); - const va_list_ty = try sema.getBuiltinType(src, .VaList); + const va_list_ty = try sema.getStdLangType(src, .VaList); try sema.requireRuntimeBlock(block, src, null); return block.addTyOp(.c_va_copy, va_list_ty, va_list_ref); @@ -20484,7 +20484,7 @@ fn zirCVaStart(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); const src = block.nodeOffset(src_node); - const va_list_ty = try sema.getBuiltinType(src, .VaList); + const va_list_ty = try sema.getStdLangType(src, .VaList); try sema.requireRuntimeBlock(block, src, null); return block.addInst(.{ .tag = .c_va_start, @@ -22373,7 +22373,7 @@ fn resolveExportOptions( const io = comp.io; const ip = &zcu.intern_pool; - const export_options_ty = try sema.getBuiltinType(src, .ExportOptions); + const export_options_ty = try sema.getStdLangType(src, .ExportOptions); const air_ref = sema.resolveInst(zir_ref); const options = try sema.coerce(block, export_options_ty, air_ref, src); @@ -22387,7 +22387,7 @@ fn resolveExportOptions( const linkage_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "linkage", .no_embedded_nulls), linkage_src); const linkage_val = try sema.resolveConstDefinedValue(block, linkage_src, linkage_operand, .{ .simple = .export_options }); - const linkage = try sema.interpretBuiltinType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); + const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); const section_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "section", .no_embedded_nulls), section_src); const section_opt_val = try sema.resolveConstDefinedValue(block, section_src, section_operand, .{ .simple = .export_options }); @@ -22398,7 +22398,7 @@ fn resolveExportOptions( const visibility_operand = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "visibility", .no_embedded_nulls), visibility_src); const visibility_val = try sema.resolveConstDefinedValue(block, visibility_src, visibility_operand, .{ .simple = .export_options }); - const visibility = try sema.interpretBuiltinType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); + const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); if (name.len < 1) { return sema.fail(block, name_src, "exported symbol name cannot be empty", .{}); @@ -22418,19 +22418,19 @@ fn resolveExportOptions( }; } -fn resolveBuiltinEnum( +fn resolveStdLangEnum( sema: *Sema, block: *Block, src: LazySrcLoc, zir_ref: Zir.Inst.Ref, - comptime name: Zcu.BuiltinDecl, + comptime name: Zcu.StdLangDecl, reason: ComptimeReason, ) CompileError!@field(std.builtin, @tagName(name)) { - const ty = try sema.getBuiltinType(src, name); + const ty = try sema.getStdLangType(src, name); const air_ref = sema.resolveInst(zir_ref); const coerced = try sema.coerce(block, ty, air_ref, src); const val = try sema.resolveConstDefinedValue(block, src, coerced, reason); - return sema.interpretBuiltinType(block, src, val, @field(std.builtin, @tagName(name))); + return sema.interpretStdLangType(block, src, val, @field(std.builtin, @tagName(name))); } fn resolveAtomicOrder( @@ -22440,7 +22440,7 @@ fn resolveAtomicOrder( zir_ref: Zir.Inst.Ref, reason: ComptimeReason, ) CompileError!std.builtin.AtomicOrder { - return sema.resolveBuiltinEnum(block, src, zir_ref, .AtomicOrder, reason); + return sema.resolveStdLangEnum(block, src, zir_ref, .AtomicOrder, reason); } fn resolveAtomicRmwOp( @@ -22449,7 +22449,7 @@ fn resolveAtomicRmwOp( src: LazySrcLoc, zir_ref: Zir.Inst.Ref, ) CompileError!std.builtin.AtomicRmwOp { - return sema.resolveBuiltinEnum(block, src, zir_ref, .AtomicRmwOp, .{ .simple = .operand_atomicRmw_operation }); + return sema.resolveStdLangEnum(block, src, zir_ref, .AtomicRmwOp, .{ .simple = .operand_atomicRmw_operation }); } fn zirCmpxchg( @@ -22609,7 +22609,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air. const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; const op_src = block.builtinCallArgSrc(inst_data.src_node, 0); const operand_src = block.builtinCallArgSrc(inst_data.src_node, 1); - const operation = try sema.resolveBuiltinEnum(block, op_src, extra.lhs, .ReduceOp, .{ .simple = .operand_reduce_operation }); + const operation = try sema.resolveStdLangEnum(block, op_src, extra.lhs, .ReduceOp, .{ .simple = .operand_reduce_operation }); const operand = sema.resolveInst(extra.rhs); const operand_ty = sema.typeOf(operand); const pt = sema.pt; @@ -23196,11 +23196,11 @@ fn zirBuiltinCall(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError const extra = sema.code.extraData(Zir.Inst.BuiltinCall, inst_data.payload_index).data; const func = sema.resolveInst(extra.callee); - const modifier_ty = try sema.getBuiltinType(call_src, .CallModifier); + const modifier_ty = try sema.getStdLangType(call_src, .CallModifier); const air_ref = sema.resolveInst(extra.modifier); const modifier_ref = try sema.coerce(block, modifier_ty, air_ref, modifier_src); const modifier_val = try sema.resolveConstDefinedValue(block, modifier_src, modifier_ref, .{ .simple = .call_modifier }); - var modifier = try sema.interpretBuiltinType(block, modifier_src, modifier_val, std.builtin.CallModifier); + var modifier = try sema.interpretStdLangType(block, modifier_src, modifier_val, std.builtin.CallModifier); switch (modifier) { // These can be upgraded to comptime or nosuspend calls. .auto, .never_tail, .no_suspend => { @@ -24256,13 +24256,13 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A const body = sema.code.bodySlice(extra_index, body_len); extra_index += body.len; - const cc_ty = try sema.getBuiltinType(cc_src, .CallingConvention); + const cc_ty = try sema.getStdLangType(cc_src, .CallingConvention); const val = try sema.resolveGenericBody(block, cc_src, body, inst, cc_ty, .{ .simple = .@"callconv" }); break :blk try sema.analyzeValueAsCallconv(block, cc_src, val); } else if (extra.data.bits.has_cc_ref) blk: { const cc_ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_index]); extra_index += 1; - const cc_ty = try sema.getBuiltinType(cc_src, .CallingConvention); + const cc_ty = try sema.getStdLangType(cc_src, .CallingConvention); const uncoerced_cc = sema.resolveInst(cc_ref); const coerced_cc = try sema.coerce(block, cc_ty, uncoerced_cc, cc_src); const cc_val = try sema.resolveConstDefinedValue(block, cc_src, coerced_cc, .{ .simple = .@"callconv" }); @@ -24275,10 +24275,10 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A if (zir_decl.linkage == .@"export") { break :cc target.cCallingConvention() orelse { // This target has no default C calling convention. We sometimes trigger a similar - // error by trying to evaluate `std.builtin.CallingConvention.c`, so for consistency, + // error by trying to evaluate `std.lang.CallingConvention.c`, so for consistency, // let's eval that now and just get the transitive error. (It's guaranteed to error // because it does the exact `cCallingConvention` call we just did.) - const cc_type = try sema.getBuiltinType(cc_src, .CallingConvention); + const cc_type = try sema.getStdLangType(cc_src, .CallingConvention); _ = try sema.namespaceLookupVal( block, LazySrcLoc.unneeded, @@ -24286,7 +24286,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A try ip.getOrPutString(gpa, io, pt.tid, "c", .no_embedded_nulls), ); // The above should have errored. - @panic("std.builtin is corrupt"); + @panic("std.lang is corrupt"); }; } } @@ -24406,7 +24406,7 @@ fn resolvePrefetchOptions( const io = comp.io; const ip = &zcu.intern_pool; - const options_ty = try sema.getBuiltinType(src, .PrefetchOptions); + const options_ty = try sema.getStdLangType(src, .PrefetchOptions); const options = try sema.coerce(block, options_ty, sema.resolveInst(zir_ref), src); const rw_src = block.src(.{ .init_field_rw = src.offset.node_offset_builtin_call_arg.builtin_call_node }); @@ -24423,9 +24423,9 @@ fn resolvePrefetchOptions( const cache_val = try sema.resolveConstDefinedValue(block, cache_src, cache, .{ .simple = .prefetch_options }); return std.builtin.PrefetchOptions{ - .rw = try sema.interpretBuiltinType(block, rw_src, rw_val, std.builtin.PrefetchOptions.Rw), + .rw = try sema.interpretStdLangType(block, rw_src, rw_val, std.builtin.PrefetchOptions.Rw), .locality = @intCast(locality_val.toUnsignedInt(zcu)), - .cache = try sema.interpretBuiltinType(block, cache_src, cache_val, std.builtin.PrefetchOptions.Cache), + .cache = try sema.interpretStdLangType(block, cache_src, cache_val, std.builtin.PrefetchOptions.Cache), }; } @@ -24480,7 +24480,7 @@ fn resolveExternOptions( const ip = &zcu.intern_pool; const options_inst = sema.resolveInst(zir_ref); - const extern_options_ty = try sema.getBuiltinType(src, .ExternOptions); + const extern_options_ty = try sema.getStdLangType(src, .ExternOptions); const options = try sema.coerce(block, extern_options_ty, options_inst, src); const name_src = block.src(.{ .init_field_name = src.offset.node_offset_builtin_call_arg.builtin_call_node }); @@ -24500,11 +24500,11 @@ fn resolveExternOptions( const linkage_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "linkage", .no_embedded_nulls), linkage_src); const linkage_val = try sema.resolveConstDefinedValue(block, linkage_src, linkage_ref, .{ .simple = .extern_options }); - const linkage = try sema.interpretBuiltinType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); + const linkage = try sema.interpretStdLangType(block, linkage_src, linkage_val, std.builtin.GlobalLinkage); const visibility_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "visibility", .no_embedded_nulls), visibility_src); const visibility_val = try sema.resolveConstDefinedValue(block, visibility_src, visibility_ref, .{ .simple = .extern_options }); - const visibility = try sema.interpretBuiltinType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); + const visibility = try sema.interpretStdLangType(block, visibility_src, visibility_val, std.builtin.SymbolVisibility); const is_thread_local = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "is_thread_local", .no_embedded_nulls), thread_local_src); const is_thread_local_val = try sema.resolveConstDefinedValue(block, thread_local_src, is_thread_local, .{ .simple = .extern_options }); @@ -24523,11 +24523,11 @@ fn resolveExternOptions( const relocation_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "relocation", .no_embedded_nulls), relocation_src); const relocation_val = try sema.resolveConstDefinedValue(block, relocation_src, relocation_ref, .{ .simple = .extern_options }); - const relocation = try sema.interpretBuiltinType(block, relocation_src, relocation_val, std.builtin.ExternOptions.Relocation); + const relocation = try sema.interpretStdLangType(block, relocation_src, relocation_val, std.builtin.ExternOptions.Relocation); const decoration_ref = try sema.fieldVal(block, src, options, try ip.getOrPutString(gpa, io, pt.tid, "decoration", .no_embedded_nulls), decoration_src); const decoration_val = try sema.resolveConstDefinedValue(block, decoration_src, decoration_ref, .{ .simple = .extern_options }); - const decoration = try sema.interpretBuiltinType(block, decoration_src, decoration_val, ?std.builtin.ExternOptions.Decoration); + const decoration = try sema.interpretStdLangType(block, decoration_src, decoration_val, ?std.builtin.ExternOptions.Decoration); if (name.len == 0) { return sema.fail(block, name_src, "extern symbol name cannot be empty", .{}); @@ -24696,7 +24696,7 @@ fn zirInComptime( return if (block.isComptime()) .bool_true else .bool_false; } -fn zirBuiltinValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { +fn zirStdLangValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { const pt = sema.pt; const zcu = pt.zcu; const comp = zcu.comp; @@ -24706,9 +24706,9 @@ fn zirBuiltinValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD const src_node: std.zig.Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); const src = block.nodeOffset(src_node); - const value: Zir.Inst.BuiltinValue = @enumFromInt(extended.small); + const value: Zir.Inst.StdLangValue = @enumFromInt(extended.small); - const builtin_type: Zcu.BuiltinDecl = switch (value) { + const std_lang_type: Zcu.StdLangDecl = switch (value) { // zig fmt: off .atomic_order => .AtomicOrder, .atomic_rmw_op => .AtomicRmwOp, @@ -24732,28 +24732,28 @@ fn zirBuiltinValue(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstD // Values are handled here. .calling_convention_c => { - const callconv_ty = try sema.getBuiltinType(src, .CallingConvention); + const callconv_ty = try sema.getStdLangType(src, .CallingConvention); // Cannot use `Value.uninterpret` because `c` is a *declaration* whose value depends on the target. return try sema.namespaceLookupVal( block, src, callconv_ty.getNamespaceIndex(zcu), try ip.getOrPutString(gpa, io, pt.tid, "c", .no_embedded_nulls), - ) orelse @panic("std.builtin is corrupt"); + ) orelse @panic("std.lang is corrupt"); }, .calling_convention_inline => { - const callconv_ty = try sema.getBuiltinType(src, .CallingConvention); + const callconv_ty = try sema.getStdLangType(src, .CallingConvention); return .fromValue(Value.uninterpret( @as(std.builtin.CallingConvention, .@"inline"), callconv_ty, pt, ) catch |err| switch (err) { - error.TypeMismatch => @panic("std.builtin is corrupt"), + error.TypeMismatch => @panic("std.lang is corrupt"), error.OutOfMemory => |e| return e, }); }, }; - return .fromType(try sema.getBuiltinType(src, builtin_type)); + return .fromType(try sema.getStdLangType(src, std_lang_type)); } fn zirInplaceArithResultTy(sema: *Sema, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref { @@ -24788,14 +24788,14 @@ fn zirBranchHint(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstDat const uncoerced_hint = sema.resolveInst(extra.operand); const operand_src = block.builtinCallArgSrc(extra.node, 0); - const hint_ty = try sema.getBuiltinType(operand_src, .BranchHint); + const hint_ty = try sema.getStdLangType(operand_src, .BranchHint); const coerced_hint = try sema.coerce(block, hint_ty, uncoerced_hint, operand_src); const hint_val = try sema.resolveConstDefinedValue(block, operand_src, coerced_hint, .{ .simple = .operand_branchHint }); // We only apply the first hint in a branch. // This allows user-provided hints to override implicit cold hints. if (sema.branch_hint == null) { - sema.branch_hint = try sema.interpretBuiltinType(block, operand_src, hint_val, std.builtin.BranchHint); + sema.branch_hint = try sema.interpretStdLangType(block, operand_src, hint_val, std.builtin.BranchHint); } } @@ -25148,7 +25148,7 @@ fn getPanicIdFunc(sema: *Sema, src: LazySrcLoc, panic_id: Zcu.SimplePanicId) !In const zcu = sema.pt.zcu; const io = zcu.comp.io; try sema.ensureMemoizedStateResolved(src, .panic); - const panic_fn_index = zcu.builtin_decl_values.get(panic_id.toBuiltin()); + const panic_fn_index = zcu.std_lang_decl_values.get(panic_id.toStdLangDecl()); switch (sema.owner.unwrap()) { .@"comptime", .nav_ty, @@ -25292,7 +25292,7 @@ fn safetyPanicUnwrapError(sema: *Sema, block: *Block, src: LazySrcLoc, err: Air. if (!zcu.backendSupportsFeature(.panic_fn)) { _ = try block.addNoOp(.trap); } else { - const panic_fn = try getBuiltin(sema, src, .@"panic.unwrapError"); + const panic_fn = try getStdLangValue(sema, src, .@"panic.unwrapError"); try sema.callBuiltin(block, src, Air.internedToRef(panic_fn), .auto, &.{err}, .@"safety check"); } } @@ -25382,7 +25382,7 @@ fn addSafetyCheckCall( parent_block: *Block, src: LazySrcLoc, ok: Air.Inst.Ref, - comptime func_decl: Zcu.BuiltinDecl, + comptime func_decl: Zcu.StdLangDecl, args: []const Air.Inst.Ref, ) !void { assert(!parent_block.isComptime()); @@ -25406,7 +25406,7 @@ fn addSafetyCheckCall( if (!zcu.backendSupportsFeature(.panic_fn)) { _ = try fail_block.addNoOp(.trap); } else { - const panic_fn = try getBuiltin(sema, src, func_decl); + const panic_fn = try getStdLangValue(sema, src, func_decl); try sema.callBuiltin(&fail_block, src, Air.internedToRef(panic_fn), .auto, args, .@"safety check"); } @@ -33114,10 +33114,10 @@ pub fn analyzeAsAddressSpace( ctx: std.Target.AddressSpaceContext, ) !std.builtin.AddressSpace { const pt = sema.pt; - const addrspace_ty = try sema.getBuiltinType(src, .AddressSpace); + const addrspace_ty = try sema.getStdLangType(src, .AddressSpace); const coerced = try sema.coerce(block, addrspace_ty, air_ref, src); const addrspace_val = try sema.resolveConstDefinedValue(block, src, coerced, .{ .simple = .@"addrspace" }); - const address_space = try sema.interpretBuiltinType(block, src, addrspace_val, std.builtin.AddressSpace); + const address_space = try sema.interpretStdLangType(block, src, addrspace_val, std.builtin.AddressSpace); const target = pt.zcu.getTarget(); if (!target.supportsAddressSpace(address_space, ctx)) { @@ -33819,15 +33819,15 @@ pub const type_resolution = @import("Sema/type_resolution.zig"); pub const ensureLayoutResolved = type_resolution.ensureLayoutResolved; pub const ensureStructDefaultsResolved = type_resolution.ensureStructDefaultsResolved; -pub fn getBuiltinType(sema: *Sema, src: LazySrcLoc, decl: Zcu.BuiltinDecl) SemaError!Type { +pub fn getStdLangType(sema: *Sema, src: LazySrcLoc, decl: Zcu.StdLangDecl) SemaError!Type { assert(decl.kind() == .type); try sema.ensureMemoizedStateResolved(src, decl.stage()); - return .fromInterned(sema.pt.zcu.builtin_decl_values.get(decl)); + return .fromInterned(sema.pt.zcu.std_lang_decl_values.get(decl)); } -pub fn getBuiltin(sema: *Sema, src: LazySrcLoc, decl: Zcu.BuiltinDecl) SemaError!InternPool.Index { +pub fn getStdLangValue(sema: *Sema, src: LazySrcLoc, decl: Zcu.StdLangDecl) SemaError!InternPool.Index { assert(decl.kind() != .type); try sema.ensureMemoizedStateResolved(src, decl.stage()); - return sema.pt.zcu.builtin_decl_values.get(decl); + return sema.pt.zcu.std_lang_decl_values.get(decl); } pub const NavPtrModifiers = struct { @@ -33928,30 +33928,30 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C }; defer block.instructions.deinit(gpa); - const std_builtin_ty: Type = ty: { + const std_lang_ty: Type = ty: { const std_src = block.nodeOffset(.zero); - const decl_name = try ip.getOrPutString(gpa, io, pt.tid, "builtin", .no_embedded_nulls); + const decl_name = try ip.getOrPutString(gpa, io, pt.tid, "lang", .no_embedded_nulls); const nav = try sema.namespaceLookup(&block, std_src, block.namespace, decl_name) orelse { - return sema.fail(&block, std_src, "'std' missing 'builtin'", .{}); + return sema.fail(&block, std_src, "'std' missing 'lang'", .{}); }; const uncoerced_val = try sema.analyzeNavVal(&block, std_src, nav); const decl_src: LazySrcLoc = .{ .base_node_inst = ip.getNav(nav).srcInst(ip), .offset = .nodeOffset(.zero), }; - break :ty try sema.analyzeAsType(&block, decl_src, .std_builtin_decl, uncoerced_val); + break :ty try sema.analyzeAsType(&block, decl_src, .std_lang_decl, uncoerced_val); }; var any_changed = false; - inline for (comptime std.enums.values(Zcu.BuiltinDecl)) |builtin_decl| { - if (stage == comptime builtin_decl.stage()) { - const parent_ns_ty: Type, const parent_name: []const u8, const name: []const u8 = switch (comptime builtin_decl.access()) { - .direct => |name| .{ std_builtin_ty, "std.builtin", name }, + inline for (comptime std.enums.values(Zcu.StdLangDecl)) |std_lang_decl| { + if (stage == comptime std_lang_decl.stage()) { + const parent_ns_ty: Type, const parent_name: []const u8, const name: []const u8 = switch (comptime std_lang_decl.access()) { + .direct => |name| .{ std_lang_ty, "std.lang", name }, .nested => |nested| access: { const parent_decl, const name = nested; - const parent_ty: Type = .fromInterned(zcu.builtin_decl_values.get(parent_decl)); - break :access .{ parent_ty, "std.builtin." ++ @tagName(parent_decl), name }; + const parent_ty: Type = .fromInterned(zcu.std_lang_decl_values.get(parent_decl)); + break :access .{ parent_ty, "std.lang." ++ @tagName(parent_decl), name }; }, }; @@ -33970,25 +33970,25 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C .offset = .nodeOffset(.zero), }; - const val: Value = switch (builtin_decl.kind()) { + const val: Value = switch (std_lang_decl.kind()) { .type => val: { - const ty = try sema.analyzeAsType(&block, decl_src, .std_builtin_decl, uncoerced_val); - try sema.ensureLayoutResolved(ty, decl_src, .builtin_type); + const ty = try sema.analyzeAsType(&block, decl_src, .std_lang_decl, uncoerced_val); + try sema.ensureLayoutResolved(ty, decl_src, .std_lang_type); break :val ty.toValue(); }, .func => val: { - const func_ty = try sema.getExpectedBuiltinFnType(builtin_decl); + const func_ty = try sema.getExpectedBuiltinFnType(std_lang_decl); const coerced = try sema.coerce(&block, func_ty, uncoerced_val, decl_src); - break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_builtin_decl }); + break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_lang_decl }); }, .string => val: { const coerced = try sema.coerce(&block, .slice_const_u8, uncoerced_val, decl_src); - break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_builtin_decl }); + break :val try sema.resolveConstDefinedValue(&block, decl_src, coerced, .{ .simple = .std_lang_decl }); }, }; - if (zcu.builtin_decl_values.get(builtin_decl) != val.toIntern()) { - zcu.builtin_decl_values.set(builtin_decl, val.toIntern()); + if (zcu.std_lang_decl_values.get(std_lang_decl) != val.toIntern()) { + zcu.std_lang_decl_values.set(std_lang_decl, val.toIntern()); any_changed = true; } } @@ -33998,7 +33998,7 @@ pub fn analyzeMemoizedState(sema: *Sema, stage: InternPool.MemoizedStateStage) C } /// Given that `decl.kind() == .func`, get the type expected of the function. -fn getExpectedBuiltinFnType(sema: *Sema, decl: Zcu.BuiltinDecl) CompileError!Type { +fn getExpectedBuiltinFnType(sema: *Sema, decl: Zcu.StdLangDecl) CompileError!Type { const pt = sema.pt; return switch (decl) { // `noinline fn () void` diff --git a/src/Sema/type_resolution.zig b/src/Sema/type_resolution.zig index 00da75abecbbc211ebdda06bac46611fb7c87193..c3ef0e41f0b3b2e8febc0c6ddd451fbe35c04045 100644 --- a/src/Sema/type_resolution.zig +++ b/src/Sema/type_resolution.zig @@ -35,7 +35,7 @@ pub const LayoutResolveReason = enum { @"export", @"extern", asm_out_type, - builtin_type, + std_lang_type, /// Written after string: "while resolving type 'T' " /// e.g. "while resolving type 'MyStruct' for variable declared here" @@ -62,7 +62,7 @@ pub const LayoutResolveReason = enum { .@"export" => "for export here", .@"extern" => "for extern declaration here", .asm_out_type => "for inline assembly output type declared here", - .builtin_type => "from 'std.builtin'", + .std_lang_type => "from 'std.lang'", // zig fmt: on }; } diff --git a/src/Value.zig b/src/Value.zig index 6e7d6e1395d120cf5edc5b0f5add5fd5a23c5962..e530edd92bec949a266f22dffb7e3479931c851c 100644 --- a/src/Value.zig +++ b/src/Value.zig @@ -2199,19 +2199,19 @@ pub fn pointerDerivation(ptr_val: Value, arena: Allocator, pt: Zcu.PerThread, op const InterpretMode = enum { /// In this mode, types are assumed to match what the compiler was built with in terms of field /// order, field types, etc. This improves compiler performance. However, it means that certain - /// modifications to `std.builtin` will result in compiler crashes. + /// modifications to `std.lang` will result in compiler crashes. direct, /// In this mode, various details of the type are allowed to differ from what the compiler was built /// with. Fields are matched by name rather than index; added struct fields are ignored, and removed /// struct fields use their default value if one exists. This is slower than `.direct`, but permits - /// making certain changes to `std.builtin` (in particular reordering/adding/removing fields), so it - /// is useful when applying breaking changes. + /// making certain changes to `std.lang` (in particular reordering/adding/removing fields), so it is + /// useful when applying breaking changes. by_name, }; const interpret_mode: InterpretMode = @field(InterpretMode, @tagName(build_options.value_interpret_mode)); /// Given a `Value` representing a comptime-known value of type `T`, unwrap it into an actual `T` known to the compiler. -/// This is useful for accessing `std.builtin` structures received from comptime logic. +/// This is useful for accessing `std.lang` structures received from comptime logic. pub fn interpret(val: Value, comptime T: type, pt: Zcu.PerThread) error{ OutOfMemory, UndefinedValue, TypeMismatch }!T { const zcu = pt.zcu; const io = zcu.comp.io; @@ -2313,7 +2313,7 @@ pub fn interpret(val: Value, comptime T: type, pt: Zcu.PerThread) error{ OutOfMe } /// Given any `val` and a `Type` corresponding `@TypeOf(val)`, construct a `Value` representing it which can be used -/// within the compilation. This is useful for passing `std.builtin` structures in the compiler back to the compilation. +/// within the compilation. This is useful for passing `std.lang` structures in the compiler back to the compilation. /// This is the inverse of `interpret`. pub fn uninterpret(val: anytype, ty: Type, pt: Zcu.PerThread) error{ OutOfMemory, TypeMismatch }!Value { const T = @TypeOf(val); diff --git a/src/Zcu.zig b/src/Zcu.zig index 3e5b9a6e8f00431b864df14d9b6da9c976a1e893..f27f07d2f29c13d046df6ddd5736835070bcdc40 100644 --- a/src/Zcu.zig +++ b/src/Zcu.zig @@ -333,7 +333,7 @@ all_type_references: std.ArrayList(TypeReference) = .empty, free_type_references: std.ArrayList(u32) = .empty, /// Populated by analysis of `AnalUnit.wrap(.{ .memoized_state = s })`, where `s` depends on the element. -builtin_decl_values: BuiltinDecl.Memoized = .initFill(.none), +std_lang_decl_values: StdLangDecl.Memoized = .initFill(.none), incremental_debug_state: if (build_options.enable_debug_extensions) IncrementalDebugState else void = if (build_options.enable_debug_extensions) .init else {}, @@ -425,11 +425,11 @@ pub const EmbedTableAdapter = struct { } }; -/// Names of declarations in `std.builtin` whose values are memoized in a `BuiltinDecl.Memoized`. +/// Names of declarations in `std.lang` whose values are memoized in a `StdLangDecl.Memoized`. /// The name must exactly match the declaration name, as comptime logic is used to compute the namespace accesses. /// Parent namespaces must be before their children in this enum. For instance, `.Type` must be before `.@"Type.Fn"`. -/// Additionally, parent namespaces must be resolved in the same stage as their children; see `BuiltinDecl.stage`. -pub const BuiltinDecl = enum { +/// Additionally, parent namespaces must be resolved in the same stage as their children; see `StdLangDecl.stage`. +pub const StdLangDecl = enum { Signedness, AddressSpace, CallingConvention, @@ -508,7 +508,7 @@ pub const BuiltinDecl = enum { @"assembly.Clobbers", /// Determines what kind of validation will be done to the decl's value. - pub fn kind(decl: BuiltinDecl) enum { type, func, string } { + pub fn kind(decl: StdLangDecl) enum { type, func, string } { return switch (decl) { .returnError => .func, @@ -593,7 +593,7 @@ pub const BuiltinDecl = enum { } /// Resolution of these values is done in three distinct stages: - /// * Resolution of `std.builtin.Panic` and everything under it + /// * Resolution of `std.lang.Panic` and everything under it /// * Resolution of `VaList` /// * Resolution of `assembly` /// * Everything else @@ -606,12 +606,12 @@ pub const BuiltinDecl = enum { /// by itself. /// /// `assembly` is separate because its value depends on the target. - pub fn stage(decl: BuiltinDecl) InternPool.MemoizedStateStage { + pub fn stage(decl: StdLangDecl) InternPool.MemoizedStateStage { return switch (decl) { .VaList => .va_list, .assembly, .@"assembly.Clobbers" => .assembly, else => { - if (@intFromEnum(decl) <= @intFromEnum(BuiltinDecl.@"Type.Declaration")) { + if (@intFromEnum(decl) <= @intFromEnum(StdLangDecl.@"Type.Declaration")) { return .main; } else { return .panic; @@ -621,24 +621,24 @@ pub const BuiltinDecl = enum { } /// Based on the tag name, determines how to access this decl; either as a direct child of the - /// `std.builtin` namespace, or as a child of some preceding `BuiltinDecl` value. - pub fn access(decl: BuiltinDecl) union(enum) { + /// `std.lang` namespace, or as a child of some preceding `StdLangDecl` value. + pub fn access(decl: StdLangDecl) union(enum) { direct: []const u8, - nested: struct { BuiltinDecl, []const u8 }, + nested: struct { StdLangDecl, []const u8 }, } { @setEvalBranchQuota(2000); return switch (decl) { inline else => |tag| { const name = @tagName(tag); const split = (comptime std.mem.lastIndexOfScalar(u8, name, '.')) orelse return .{ .direct = name }; - const parent = @field(BuiltinDecl, name[0..split]); + const parent = @field(StdLangDecl, name[0..split]); comptime assert(@intFromEnum(parent) < @intFromEnum(tag)); // dependencies ordered correctly return .{ .nested = .{ parent, name[split + 1 ..] } }; }, }; } - const Memoized = std.enums.EnumArray(BuiltinDecl, InternPool.Index); + const Memoized = std.enums.EnumArray(StdLangDecl, InternPool.Index); }; pub const SimplePanicId = enum { @@ -662,7 +662,7 @@ pub const SimplePanicId = enum { memcpy_alias, noreturn_returned, - pub fn toBuiltin(id: SimplePanicId) BuiltinDecl { + pub fn toStdLangDecl(id: SimplePanicId) StdLangDecl { return switch (id) { // zig fmt: off .reached_unreachable => .@"panic.reachedUnreachable", @@ -3941,7 +3941,7 @@ pub fn addGlobalAssembly(zcu: *Zcu, unit: AnalUnit, source: []const u8) !void { pub const Feature = enum { /// When this feature is enabled, Sema will emit calls to - /// `std.builtin.panic` functions for things like safety checks and + /// `std.lang.panic` functions for things like safety checks and /// unreachables. Otherwise traps will be emitted. panic_fn, /// When this feature is enabled, Sema will insert tracer functions for gathering a stack @@ -4995,7 +4995,7 @@ fn addDependencyLoopErrorLine( }), .memoized_state => |stage| switch (stage) { .panic => try eb.printString("{f} requires panic handler for call here", .{fmt_source}), - else => try eb.printString("{f} requires 'std.builtin' declarations here", .{fmt_source}), + else => try eb.printString("{f} requires 'std.lang' declarations here", .{fmt_source}), }, .func => |func| try eb.printString("{f} uses inferred error set of function '{f}' here", .{ fmt_source, ip.getNav(zcu.funcInfo(func).owner_nav).fqn.fmt(ip), @@ -5046,7 +5046,7 @@ fn formatDependencyLoopSourceUnit(data: FormatAnalUnit, w: *Io.Writer) Io.Writer .nav_ty => |nav| try w.print("type of declaration '{f}'", .{ip.getNav(nav).fqn.fmt(ip)}), .memoized_state => |stage| switch (stage) { .panic => try w.writeAll("panic handler"), - else => try w.writeAll("'std.builtin' declarations"), + else => try w.writeAll("'std.lang' declarations"), }, .type_layout => |ty| try w.print("type '{f}'", .{ Type.fromInterned(ty).containerTypeName(ip).fmt(ip), diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index a3728c5500573cd261a3b3c3387f618b7536a46f..2e6f7b49b8147d2092ebd858deecb56b04625c61 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -1083,13 +1083,13 @@ pub fn ensureMemoizedStateUpToDate( } else { if (prev_failed) return error.AnalysisFail; // We use an arbitrary element to check if the state has been resolved yet. - const to_check: Zcu.BuiltinDecl = switch (stage) { + const to_check: Zcu.StdLangDecl = switch (stage) { .main => .Type, .panic => .panic, .va_list => .VaList, .assembly => .assembly, }; - if (zcu.builtin_decl_values.get(to_check) != .none) return; + if (zcu.std_lang_decl_values.get(to_check) != .none) return; } if (zcu.comp.debugIncremental()) { @@ -3751,7 +3751,7 @@ pub fn populateTestFunctions(pt: Zcu.PerThread) Allocator.Error!void { // Our job is to correctly set the value of the `test_functions` declaration if it has been // analyzed and sent to codegen, It usually will have been, because the test runner will - // reference it, and `std.builtin` shouldn't have type errors. However, if it hasn't been + // reference it, and `std.lang` shouldn't have type errors. However, if it hasn't been // analyzed, we will just terminate early, since clearly the test runner hasn't referenced // `test_functions` so there's no point populating it. More to the the point, we potentially // *can't* populate it without doing some type resolution, and... let's try to leave Sema in diff --git a/src/codegen/aarch64/Select.zig b/src/codegen/aarch64/Select.zig index d0f7c45a0637ef6ccb889658041700a5d98495d8..968bb3134bc9f107789ce6807d146cafe79ab7e6 100644 --- a/src/codegen/aarch64/Select.zig +++ b/src/codegen/aarch64/Select.zig @@ -7981,7 +7981,7 @@ fn emit(isel: *Select, instruction: codegen.aarch64.encoding.Instruction) !void fn emitPanic(isel: *Select, panic_id: Zcu.SimplePanicId) !void { const zcu = isel.pt.zcu; try isel.nav_relocs.append(zcu.gpa, .{ - .nav = switch (zcu.intern_pool.indexToKey(zcu.builtin_decl_values.get(panic_id.toBuiltin()))) { + .nav = switch (zcu.intern_pool.indexToKey(zcu.std_lang_decl_values.get(panic_id.toStdLangDecl()))) { else => unreachable, inline .@"extern", .func => |func| func.owner_nav, }, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 847191ec1d67a51efc586ce87e209f6915e51f4b..eeac3e09d9b5c80aed5f9bbfbb736e8b8dde15db 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1755,7 +1755,7 @@ pub const Object = struct { } // If the first export specifies a linksection, set the exported variable's section to that - // one. This is kind of a hack because `std.builtin.ExportOptions.section` doesn't actually + // one. This is kind of a hack because `std.lang.ExportOptions.section` doesn't actually // make much sense: the linksection should be associated with the declaration itself rather // than some particular symbol it is exported as! if (export_indices[0].ptr(zcu).opts.section.toSlice(ip)) |section_slice| { @@ -3378,7 +3378,7 @@ pub const Object = struct { } if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) { - // First parameter is a pointer to `std.builtin.StackTrace`. + // First parameter is a pointer to `std.lang.StackTrace`. const llvm_ptr_ty = try o.builder.ptrType(toLlvmAddressSpace(.generic, target)); try llvm_params.append(o.gpa, llvm_ptr_ty); } diff --git a/src/codegen/llvm/FuncGen.zig b/src/codegen/llvm/FuncGen.zig index e1942a624d0d4fecc5c4951dec339ad656deee96..e7683ab95ee080c6c80e47d29950877d79793829 100644 --- a/src/codegen/llvm/FuncGen.zig +++ b/src/codegen/llvm/FuncGen.zig @@ -891,7 +891,7 @@ fn buildSimplePanic(fg: *FuncGen, panic_id: Zcu.SimplePanicId) Allocator.Error!v const o = fg.object; const zcu = o.zcu; const target = zcu.getTarget(); - const panic_func = zcu.funcInfo(zcu.builtin_decl_values.get(panic_id.toBuiltin())); + const panic_func = zcu.funcInfo(zcu.std_lang_decl_values.get(panic_id.toStdLangDecl())); const fn_info = zcu.typeToFunc(.fromInterned(panic_func.ty)).?; const llvm_panic_fn_ty = try o.lowerType(.fromInterned(panic_func.ty)); diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig index daf02bd8dcce573664a86585cc12f4bf4dc61298..0069db375bd115046f470b80ab849d7222519150 100644 --- a/src/codegen/spirv/CodeGen.zig +++ b/src/codegen/spirv/CodeGen.zig @@ -2358,7 +2358,7 @@ fn buildWideMul( /// The SPIR-V backend is not yet advanced enough to support the std testing infrastructure. /// In order to be able to run tests, we "temporarily" lower test kernels into separate entry- /// points. The test executor will then be able to invoke these to run the tests. -/// Note that tests are lowered according to std.builtin.TestFn, which is `fn () anyerror!void`. +/// Note that tests are lowered according to std.lang.TestFn, which is `fn () anyerror!void`. /// (anyerror!void has the same layout as anyerror). /// Each test declaration generates a function like. /// %anyerror = OpTypeInt 0 16 diff --git a/src/codegen/wasm/CodeGen.zig b/src/codegen/wasm/CodeGen.zig index 415f6d15f9cc9684882ceda84c9893f9339427db..7061d8548df43049b14b8244cf9c9f6ef6b9e226 100644 --- a/src/codegen/wasm/CodeGen.zig +++ b/src/codegen/wasm/CodeGen.zig @@ -586,7 +586,7 @@ fn addExtraAssumeCapacity(cg: *CodeGen, extra: anytype) error{OutOfMemory}!u32 { return result; } -/// For `std.builtin.CallingConvention.auto`. +/// For `std.lang.CallingConvention.auto`. pub fn typeToValtype(ty: Type, zcu: *const Zcu, target: *const std.Target) std.wasm.Valtype { return switch (ty.zigTypeTag(zcu)) { .float => switch (ty.floatBits(target)) { diff --git a/src/print_zir.zig b/src/print_zir.zig index 6647abe88a5333e08854a32f2af4dbfee36a0663..6f7af6c33c80eb0034640b3bf40e85c9990eecd7 100644 --- a/src/print_zir.zig +++ b/src/print_zir.zig @@ -693,7 +693,7 @@ const Writer = struct { .restore_err_ret_index => try self.writeRestoreErrRetIndex(stream, extended), .closure_get => try self.writeClosureGet(stream, extended), .field_parent_ptr => try self.writeFieldParentPtr(stream, extended), - .builtin_value => try self.writeBuiltinValue(stream, extended), + .std_lang_value => try self.writeStdLangValue(stream, extended), .inplace_arith_result_ty => try self.writeInplaceArithResultTy(stream, extended), .dbg_empty_stmt => try stream.writeAll("))"), @@ -2232,8 +2232,8 @@ const Writer = struct { try self.writeSrcNode(stream, src_node); } - fn writeBuiltinValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { - const val: Zir.Inst.BuiltinValue = @enumFromInt(extended.small); + fn writeStdLangValue(self: *Writer, stream: *std.Io.Writer, extended: Zir.Inst.Extended.InstData) !void { + const val: Zir.Inst.StdLangValue = @enumFromInt(extended.small); try stream.print("{s})) ", .{@tagName(val)}); const src_node: Ast.Node.Offset = @enumFromInt(@as(i32, @bitCast(extended.operand))); try self.writeSrcNode(stream, src_node); diff --git a/test/cases/compile_errors/invalid_member_of_builtin_enum.zig b/test/cases/compile_errors/invalid_member_of_builtin_enum.zig index c58029f2f585fce193ab6de35d3d11d54c1b3d1a..48f1012c1f6884d6a34c2255edd9e2924743c1b1 100644 --- a/test/cases/compile_errors/invalid_member_of_builtin_enum.zig +++ b/test/cases/compile_errors/invalid_member_of_builtin_enum.zig @@ -1,10 +1,10 @@ -const builtin = @import("std").builtin; +const lang = @import("std").lang; export fn entry() void { - const foo = builtin.OptimizeMode.x86; + const foo = lang.OptimizeMode.x86; _ = foo; } // error // -// :3:38: error: enum 'builtin.OptimizeMode' has no member named 'x86' +// :3:35: error: enum 'lang.OptimizeMode' has no member named 'x86' // : note: enum declared here diff --git a/test/cases/compile_errors/issue_15572_break_on_inline_while.zig b/test/cases/compile_errors/issue_15572_break_on_inline_while.zig index bd4b432a4272e41743770a7da74613411770e5a1..d1dc5072324ee66acae55c361fcd148f729c168c 100644 --- a/test/cases/compile_errors/issue_15572_break_on_inline_while.zig +++ b/test/cases/compile_errors/issue_15572_break_on_inline_while.zig @@ -16,4 +16,4 @@ pub fn main() void { // error // target=x86_64-linux // -// :9:28: error: incompatible types: 'builtin.Type.EnumField' and 'void' +// :9:28: error: incompatible types: 'lang.Type.EnumField' and 'void' diff --git a/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig b/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig index b4cf100c19978597ccf5f987f69fdebe1345a848..b212eebbdb7546617e0423e72d8f05f16dd2178d 100644 --- a/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig +++ b/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig @@ -12,6 +12,6 @@ export fn entry() void { // error // -// :9:54: error: values of type 'builtin.Type.StructField' must be comptime-known, but index value is runtime-known +// :9:54: error: values of type 'lang.Type.StructField' must be comptime-known, but index value is runtime-known // : note: struct requires comptime because of this field // : note: types are not available at runtime diff --git a/test/cases/compile_errors/wrong_type_for_reify_type.zig b/test/cases/compile_errors/wrong_type_for_reify_type.zig index cf93ff91b4dc0c1207b74bff9fdae87023155128..d5f3b56676d693225f125ac8683cfe6eb5052dd8 100644 --- a/test/cases/compile_errors/wrong_type_for_reify_type.zig +++ b/test/cases/compile_errors/wrong_type_for_reify_type.zig @@ -16,10 +16,10 @@ export fn entryU() void { // error // -// :2:14: error: expected type 'builtin.Signedness', found 'comptime_int' +// :2:14: error: expected type 'lang.Signedness', found 'comptime_int' // :?:?: note: enum declared here // :6:15: error: expected type 'type', found 'comptime_int' -// :10:17: error: expected type 'builtin.Type.ContainerLayout', found 'comptime_int' +// :10:17: error: expected type 'lang.Type.ContainerLayout', found 'comptime_int' // :?:?: enum declared here -// :14:16: error: expected type 'builtin.Type.ContainerLayout', found 'comptime_int' +// :14:16: error: expected type 'lang.Type.ContainerLayout', found 'comptime_int' // :?:?: enum declared here diff --git a/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig b/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig index fdb49d344a941d2f5e97138974696f7e7711dfa2..62a10262770bdb3350238ef0a703ce370bfd1476 100644 --- a/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig +++ b/test/cases/compile_errors/wrong_types_given_to_atomic_order_args_in_cmpxchg.zig @@ -5,5 +5,5 @@ export fn entry() void { // error // -// :3:47: error: expected type 'builtin.AtomicOrder', found 'u32' +// :3:47: error: expected type 'lang.AtomicOrder', found 'u32' // :?:?: note: enum declared here diff --git a/test/cases/compile_errors/wrong_types_given_to_export.zig b/test/cases/compile_errors/wrong_types_given_to_export.zig index ab26b399e977f7c3b5a8cf905f5398aa295f28eb..f859f5fda207cb70a19002d38fcb1e25f50e2e18 100644 --- a/test/cases/compile_errors/wrong_types_given_to_export.zig +++ b/test/cases/compile_errors/wrong_types_given_to_export.zig @@ -5,5 +5,5 @@ comptime { // error // -// :3:42: error: expected type 'builtin.GlobalLinkage', found 'u32' +// :3:42: error: expected type 'lang.GlobalLinkage', found 'u32' // :?:?: note: enum declared here