| author | |
| committer | |
| log | aac800ec65f0d6f6b9eead07330d42c6551739fd |
| tree | cd8959e3167f380416166db0a55ca86cac0e0f27 |
| parent | db7db48028b79842bffe2227c14d094800351373 |
| signature |
13 files changed, 46 insertions(+), 46 deletions(-)
doc/langref.html.in+4-4| ... | ... | @@ -3679,22 +3679,22 @@ void do_a_thing(struct Foo *foo) { |
| 3679 | 3679 | <tr> |
| 3680 | 3680 | <th scope="row">{#syntax#}.{x}{#endsyntax#}</th> |
| 3681 | 3681 | <td>{#syntax#}T{#endsyntax#}</td> |
| 3682 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}std.meta.FieldType(T, .@"0"){#endsyntax#}</td> | |
| 3682 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}@FieldType(T, "0"){#endsyntax#}</td> | |
| 3683 | 3683 | </tr> |
| 3684 | 3684 | <tr> |
| 3685 | 3685 | <th scope="row">{#syntax#}.{ .a = x }{#endsyntax#}</th> |
| 3686 | 3686 | <td>{#syntax#}T{#endsyntax#}</td> |
| 3687 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}std.meta.FieldType(T, .a){#endsyntax#}</td> | |
| 3687 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}@FieldType(T, "a"){#endsyntax#}</td> | |
| 3688 | 3688 | </tr> |
| 3689 | 3689 | <tr> |
| 3690 | 3690 | <th scope="row">{#syntax#}T{x}{#endsyntax#}</th> |
| 3691 | 3691 | <td>-</td> |
| 3692 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}std.meta.FieldType(T, .@"0"){#endsyntax#}</td> | |
| 3692 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}@FieldType(T, "0"){#endsyntax#}</td> | |
| 3693 | 3693 | </tr> |
| 3694 | 3694 | <tr> |
| 3695 | 3695 | <th scope="row">{#syntax#}T{ .a = x }{#endsyntax#}</th> |
| 3696 | 3696 | <td>-</td> |
| 3697 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}std.meta.FieldType(T, .a){#endsyntax#}</td> | |
| 3697 | <td>{#syntax#}x{#endsyntax#} is a {#syntax#}@FieldType(T, "a"){#endsyntax#}</td> | |
| 3698 | 3698 | </tr> |
| 3699 | 3699 | <tr> |
| 3700 | 3700 | <th scope="row">{#syntax#}@Type(x){#endsyntax#}</th> |
lib/compiler/aro_translate_c/ast.zig+1-1| ... | ... | @@ -394,7 +394,7 @@ pub const Node = extern union { |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | pub fn Data(comptime t: Tag) type { |
| 397 | return std.meta.fieldInfo(t.Type(), .data).type; | |
| 397 | return @FieldType(t.Type(), "data"); | |
| 398 | 398 | } |
| 399 | 399 | }; |
| 400 | 400 |
lib/std/array_hash_map.zig+4-4| ... | ... | @@ -2486,13 +2486,13 @@ test "reIndex" { |
| 2486 | 2486 | test "auto store_hash" { |
| 2487 | 2487 | const HasCheapEql = AutoArrayHashMap(i32, i32); |
| 2488 | 2488 | const HasExpensiveEql = AutoArrayHashMap([32]i32, i32); |
| 2489 | try testing.expect(std.meta.fieldInfo(HasCheapEql.Data, .hash).type == void); | |
| 2490 | try testing.expect(std.meta.fieldInfo(HasExpensiveEql.Data, .hash).type != void); | |
| 2489 | try testing.expect(@FieldType(HasCheapEql.Data, "hash") == void); | |
| 2490 | try testing.expect(@FieldType(HasExpensiveEql.Data, "hash") != void); | |
| 2491 | 2491 | |
| 2492 | 2492 | const HasCheapEqlUn = AutoArrayHashMapUnmanaged(i32, i32); |
| 2493 | 2493 | const HasExpensiveEqlUn = AutoArrayHashMapUnmanaged([32]i32, i32); |
| 2494 | try testing.expect(std.meta.fieldInfo(HasCheapEqlUn.Data, .hash).type == void); | |
| 2495 | try testing.expect(std.meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).type != void); | |
| 2494 | try testing.expect(@FieldType(HasCheapEqlUn.Data, "hash") == void); | |
| 2495 | try testing.expect(@FieldType(HasExpensiveEqlUn.Data, "hash") != void); | |
| 2496 | 2496 | } |
| 2497 | 2497 | |
| 2498 | 2498 | test "sort" { |
lib/std/multi_array_list.zig+1-1| ... | ... | @@ -565,7 +565,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | fn FieldType(comptime field: Field) type { |
| 568 | return meta.fieldInfo(Elem, field).type; | |
| 568 | return @FieldType(Elem, @tagName(field)); | |
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | const Entry = entry: { |
lib/std/zig/llvm/Builder.zig+3-3| ... | ... | @@ -7526,9 +7526,9 @@ pub const Constant = enum(u32) { |
| 7526 | 7526 | }; |
| 7527 | 7527 | } |
| 7528 | 7528 | }; |
| 7529 | const Mantissa64 = std.meta.FieldType(Float.Repr(f64), .mantissa); | |
| 7530 | const Exponent32 = std.meta.FieldType(Float.Repr(f32), .exponent); | |
| 7531 | const Exponent64 = std.meta.FieldType(Float.Repr(f64), .exponent); | |
| 7529 | const Mantissa64 = @FieldType(Float.Repr(f64), "mantissa"); | |
| 7530 | const Exponent32 = @FieldType(Float.Repr(f32), "exponent"); | |
| 7531 | const Exponent64 = @FieldType(Float.Repr(f64), "exponent"); | |
| 7532 | 7532 | |
| 7533 | 7533 | const repr: Float.Repr(f32) = @bitCast(item.data); |
| 7534 | 7534 | const denormal_shift = switch (repr.exponent) { |
src/Compilation.zig+1-1| ... | ... | @@ -1512,7 +1512,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil |
| 1512 | 1512 | .emit_asm = options.emit_asm, |
| 1513 | 1513 | .emit_llvm_ir = options.emit_llvm_ir, |
| 1514 | 1514 | .emit_llvm_bc = options.emit_llvm_bc, |
| 1515 | .work_queues = .{std.fifo.LinearFifo(Job, .Dynamic).init(gpa)} ** @typeInfo(std.meta.FieldType(Compilation, .work_queues)).array.len, | |
| 1515 | .work_queues = @splat(.init(gpa)), | |
| 1516 | 1516 | .c_object_work_queue = std.fifo.LinearFifo(*CObject, .Dynamic).init(gpa), |
| 1517 | 1517 | .win32_resource_work_queue = if (dev.env.supports(.win32_resource)) std.fifo.LinearFifo(*Win32Resource, .Dynamic).init(gpa) else .{}, |
| 1518 | 1518 | .astgen_work_queue = std.fifo.LinearFifo(Zcu.File.Index, .Dynamic).init(gpa), |
src/Sema.zig+1-1| ... | ... | @@ -13519,7 +13519,7 @@ fn validateErrSetSwitch( |
| 13519 | 13519 | seen_errors: *SwitchErrorSet, |
| 13520 | 13520 | case_vals: *std.ArrayListUnmanaged(Air.Inst.Ref), |
| 13521 | 13521 | operand_ty: Type, |
| 13522 | inst_data: std.meta.FieldType(Zir.Inst.Data, .pl_node), | |
| 13522 | inst_data: @FieldType(Zir.Inst.Data, "pl_node"), | |
| 13523 | 13523 | scalar_cases_len: u32, |
| 13524 | 13524 | multi_cases_len: u32, |
| 13525 | 13525 | else_case: struct { body: []const Zir.Inst.Index, end: usize, src: LazySrcLoc }, |
src/arch/x86_64/Encoding.zig+2-2| ... | ... | @@ -1030,8 +1030,8 @@ const mnemonic_to_encodings_map = init: { |
| 1030 | 1030 | storage_i += value.len; |
| 1031 | 1031 | } |
| 1032 | 1032 | var mnemonic_i: [mnemonic_count]usize = @splat(0); |
| 1033 | const ops_len = @typeInfo(std.meta.FieldType(Data, .ops)).array.len; | |
| 1034 | const opc_len = @typeInfo(std.meta.FieldType(Data, .opc)).array.len; | |
| 1033 | const ops_len = @typeInfo(@FieldType(Data, "ops")).array.len; | |
| 1034 | const opc_len = @typeInfo(@FieldType(Data, "opc")).array.len; | |
| 1035 | 1035 | for (encodings) |entry| { |
| 1036 | 1036 | const i = &mnemonic_i[@intFromEnum(entry[0])]; |
| 1037 | 1037 | mnemonic_map[@intFromEnum(entry[0])][i.*] = .{ |
src/link/Coff.zig+6-6| ... | ... | @@ -3497,9 +3497,9 @@ pub const Relocation = struct { |
| 3497 | 3497 | const target_page = @as(i32, @intCast(ctx.target_vaddr >> 12)); |
| 3498 | 3498 | const pages = @as(u21, @bitCast(@as(i21, @intCast(target_page - source_page)))); |
| 3499 | 3499 | var inst = aarch64_util.Instruction{ |
| 3500 | .pc_relative_address = mem.bytesToValue(std.meta.TagPayload( | |
| 3500 | .pc_relative_address = mem.bytesToValue(@FieldType( | |
| 3501 | 3501 | aarch64_util.Instruction, |
| 3502 | aarch64_util.Instruction.pc_relative_address, | |
| 3502 | @tagName(aarch64_util.Instruction.pc_relative_address), | |
| 3503 | 3503 | ), buffer[0..4]), |
| 3504 | 3504 | }; |
| 3505 | 3505 | inst.pc_relative_address.immhi = @as(u19, @truncate(pages >> 2)); |
| ... | ... | @@ -3512,18 +3512,18 @@ pub const Relocation = struct { |
| 3512 | 3512 | const narrowed = @as(u12, @truncate(@as(u64, @intCast(ctx.target_vaddr)))); |
| 3513 | 3513 | if (isArithmeticOp(buffer[0..4])) { |
| 3514 | 3514 | var inst = aarch64_util.Instruction{ |
| 3515 | .add_subtract_immediate = mem.bytesToValue(std.meta.TagPayload( | |
| 3515 | .add_subtract_immediate = mem.bytesToValue(@FieldType( | |
| 3516 | 3516 | aarch64_util.Instruction, |
| 3517 | aarch64_util.Instruction.add_subtract_immediate, | |
| 3517 | @tagName(aarch64_util.Instruction.add_subtract_immediate), | |
| 3518 | 3518 | ), buffer[0..4]), |
| 3519 | 3519 | }; |
| 3520 | 3520 | inst.add_subtract_immediate.imm12 = narrowed; |
| 3521 | 3521 | mem.writeInt(u32, buffer[0..4], inst.toU32(), .little); |
| 3522 | 3522 | } else { |
| 3523 | 3523 | var inst = aarch64_util.Instruction{ |
| 3524 | .load_store_register = mem.bytesToValue(std.meta.TagPayload( | |
| 3524 | .load_store_register = mem.bytesToValue(@FieldType( | |
| 3525 | 3525 | aarch64_util.Instruction, |
| 3526 | aarch64_util.Instruction.load_store_register, | |
| 3526 | @tagName(aarch64_util.Instruction.load_store_register), | |
| 3527 | 3527 | ), buffer[0..4]), |
| 3528 | 3528 | }; |
| 3529 | 3529 | const offset: u12 = blk: { |
src/link/Elf/Atom.zig+4-4| ... | ... | @@ -1783,9 +1783,9 @@ const aarch64 = struct { |
| 1783 | 1783 | aarch64_util.writeAddImmInst(off, code); |
| 1784 | 1784 | } else { |
| 1785 | 1785 | const old_inst: Instruction = .{ |
| 1786 | .add_subtract_immediate = mem.bytesToValue(std.meta.TagPayload( | |
| 1786 | .add_subtract_immediate = mem.bytesToValue(@FieldType( | |
| 1787 | 1787 | Instruction, |
| 1788 | Instruction.add_subtract_immediate, | |
| 1788 | @tagName(Instruction.add_subtract_immediate), | |
| 1789 | 1789 | ), code), |
| 1790 | 1790 | }; |
| 1791 | 1791 | const rd: Register = @enumFromInt(old_inst.add_subtract_immediate.rd); |
| ... | ... | @@ -1797,9 +1797,9 @@ const aarch64 = struct { |
| 1797 | 1797 | |
| 1798 | 1798 | .TLSDESC_CALL => if (!target.flags.has_tlsdesc) { |
| 1799 | 1799 | const old_inst: Instruction = .{ |
| 1800 | .unconditional_branch_register = mem.bytesToValue(std.meta.TagPayload( | |
| 1800 | .unconditional_branch_register = mem.bytesToValue(@FieldType( | |
| 1801 | 1801 | Instruction, |
| 1802 | Instruction.unconditional_branch_register, | |
| 1802 | @tagName(Instruction.unconditional_branch_register), | |
| 1803 | 1803 | ), code), |
| 1804 | 1804 | }; |
| 1805 | 1805 | const rn: Register = @enumFromInt(old_inst.unconditional_branch_register.rn); |
src/link/MachO/Atom.zig+6-6| ... | ... | @@ -794,9 +794,9 @@ fn resolveRelocInner( |
| 794 | 794 | aarch64.writeAddImmInst(@truncate(target), inst_code); |
| 795 | 795 | } else { |
| 796 | 796 | var inst = aarch64.Instruction{ |
| 797 | .load_store_register = mem.bytesToValue(std.meta.TagPayload( | |
| 797 | .load_store_register = mem.bytesToValue(@FieldType( | |
| 798 | 798 | aarch64.Instruction, |
| 799 | aarch64.Instruction.load_store_register, | |
| 799 | @tagName(aarch64.Instruction.load_store_register), | |
| 800 | 800 | ), inst_code), |
| 801 | 801 | }; |
| 802 | 802 | inst.load_store_register.offset = switch (inst.load_store_register.size) { |
| ... | ... | @@ -843,9 +843,9 @@ fn resolveRelocInner( |
| 843 | 843 | const inst_code = code[rel_offset..][0..4]; |
| 844 | 844 | const reg_info: RegInfo = blk: { |
| 845 | 845 | if (aarch64.isArithmeticOp(inst_code)) { |
| 846 | const inst = mem.bytesToValue(std.meta.TagPayload( | |
| 846 | const inst = mem.bytesToValue(@FieldType( | |
| 847 | 847 | aarch64.Instruction, |
| 848 | aarch64.Instruction.add_subtract_immediate, | |
| 848 | @tagName(aarch64.Instruction.add_subtract_immediate), | |
| 849 | 849 | ), inst_code); |
| 850 | 850 | break :blk .{ |
| 851 | 851 | .rd = inst.rd, |
| ... | ... | @@ -853,9 +853,9 @@ fn resolveRelocInner( |
| 853 | 853 | .size = inst.sf, |
| 854 | 854 | }; |
| 855 | 855 | } else { |
| 856 | const inst = mem.bytesToValue(std.meta.TagPayload( | |
| 856 | const inst = mem.bytesToValue(@FieldType( | |
| 857 | 857 | aarch64.Instruction, |
| 858 | aarch64.Instruction.load_store_register, | |
| 858 | @tagName(aarch64.Instruction.load_store_register), | |
| 859 | 859 | ), inst_code); |
| 860 | 860 | break :blk .{ |
| 861 | 861 | .rd = inst.rt, |
src/link/aarch64.zig+8-8| ... | ... | @@ -5,9 +5,9 @@ pub inline fn isArithmeticOp(inst: *const [4]u8) bool { |
| 5 | 5 | |
| 6 | 6 | pub fn writeAddImmInst(value: u12, code: *[4]u8) void { |
| 7 | 7 | var inst = Instruction{ |
| 8 | .add_subtract_immediate = mem.bytesToValue(std.meta.TagPayload( | |
| 8 | .add_subtract_immediate = mem.bytesToValue(@FieldType( | |
| 9 | 9 | Instruction, |
| 10 | Instruction.add_subtract_immediate, | |
| 10 | @tagName(Instruction.add_subtract_immediate), | |
| 11 | 11 | ), code), |
| 12 | 12 | }; |
| 13 | 13 | inst.add_subtract_immediate.imm12 = value; |
| ... | ... | @@ -16,9 +16,9 @@ pub fn writeAddImmInst(value: u12, code: *[4]u8) void { |
| 16 | 16 | |
| 17 | 17 | pub fn writeLoadStoreRegInst(value: u12, code: *[4]u8) void { |
| 18 | 18 | var inst: Instruction = .{ |
| 19 | .load_store_register = mem.bytesToValue(std.meta.TagPayload( | |
| 19 | .load_store_register = mem.bytesToValue(@FieldType( | |
| 20 | 20 | Instruction, |
| 21 | Instruction.load_store_register, | |
| 21 | @tagName(Instruction.load_store_register), | |
| 22 | 22 | ), code), |
| 23 | 23 | }; |
| 24 | 24 | inst.load_store_register.offset = value; |
| ... | ... | @@ -34,9 +34,9 @@ pub fn calcNumberOfPages(saddr: i64, taddr: i64) error{Overflow}!i21 { |
| 34 | 34 | |
| 35 | 35 | pub fn writeAdrpInst(pages: u21, code: *[4]u8) void { |
| 36 | 36 | var inst = Instruction{ |
| 37 | .pc_relative_address = mem.bytesToValue(std.meta.TagPayload( | |
| 37 | .pc_relative_address = mem.bytesToValue(@FieldType( | |
| 38 | 38 | Instruction, |
| 39 | Instruction.pc_relative_address, | |
| 39 | @tagName(Instruction.pc_relative_address), | |
| 40 | 40 | ), code), |
| 41 | 41 | }; |
| 42 | 42 | inst.pc_relative_address.immhi = @as(u19, @truncate(pages >> 2)); |
| ... | ... | @@ -46,9 +46,9 @@ pub fn writeAdrpInst(pages: u21, code: *[4]u8) void { |
| 46 | 46 | |
| 47 | 47 | pub fn writeBranchImm(disp: i28, code: *[4]u8) void { |
| 48 | 48 | var inst = Instruction{ |
| 49 | .unconditional_branch_immediate = mem.bytesToValue(std.meta.TagPayload( | |
| 49 | .unconditional_branch_immediate = mem.bytesToValue(@FieldType( | |
| 50 | 50 | Instruction, |
| 51 | Instruction.unconditional_branch_immediate, | |
| 51 | @tagName(Instruction.unconditional_branch_immediate), | |
| 52 | 52 | ), code), |
| 53 | 53 | }; |
| 54 | 54 | inst.unconditional_branch_immediate.imm26 = @as(u26, @truncate(@as(u28, @bitCast(disp >> 2)))); |
src/link/riscv.zig+5-5| ... | ... | @@ -50,27 +50,27 @@ pub fn writeAddend( |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | pub fn writeInstU(code: *[4]u8, value: u32) void { |
| 53 | var data: Instruction = .{ .U = mem.bytesToValue(std.meta.TagPayload(Instruction, .U), code) }; | |
| 53 | var data: Instruction = .{ .U = mem.bytesToValue(@FieldType(Instruction, "U"), code) }; | |
| 54 | 54 | const compensated: u32 = @bitCast(@as(i32, @bitCast(value)) + 0x800); |
| 55 | 55 | data.U.imm12_31 = bitSlice(compensated, 31, 12); |
| 56 | 56 | mem.writeInt(u32, code, data.toU32(), .little); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | pub fn writeInstI(code: *[4]u8, value: u32) void { |
| 60 | var data: Instruction = .{ .I = mem.bytesToValue(std.meta.TagPayload(Instruction, .I), code) }; | |
| 60 | var data: Instruction = .{ .I = mem.bytesToValue(@FieldType(Instruction, "I"), code) }; | |
| 61 | 61 | data.I.imm0_11 = bitSlice(value, 11, 0); |
| 62 | 62 | mem.writeInt(u32, code, data.toU32(), .little); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | pub fn writeInstS(code: *[4]u8, value: u32) void { |
| 66 | var data: Instruction = .{ .S = mem.bytesToValue(std.meta.TagPayload(Instruction, .S), code) }; | |
| 66 | var data: Instruction = .{ .S = mem.bytesToValue(@FieldType(Instruction, "S"), code) }; | |
| 67 | 67 | data.S.imm0_4 = bitSlice(value, 4, 0); |
| 68 | 68 | data.S.imm5_11 = bitSlice(value, 11, 5); |
| 69 | 69 | mem.writeInt(u32, code, data.toU32(), .little); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | pub fn writeInstJ(code: *[4]u8, value: u32) void { |
| 73 | var data: Instruction = .{ .J = mem.bytesToValue(std.meta.TagPayload(Instruction, .J), code) }; | |
| 73 | var data: Instruction = .{ .J = mem.bytesToValue(@FieldType(Instruction, "J"), code) }; | |
| 74 | 74 | data.J.imm1_10 = bitSlice(value, 10, 1); |
| 75 | 75 | data.J.imm11 = bitSlice(value, 11, 11); |
| 76 | 76 | data.J.imm12_19 = bitSlice(value, 19, 12); |
| ... | ... | @@ -79,7 +79,7 @@ pub fn writeInstJ(code: *[4]u8, value: u32) void { |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | pub fn writeInstB(code: *[4]u8, value: u32) void { |
| 82 | var data: Instruction = .{ .B = mem.bytesToValue(std.meta.TagPayload(Instruction, .B), code) }; | |
| 82 | var data: Instruction = .{ .B = mem.bytesToValue(@FieldType(Instruction, "B"), code) }; | |
| 83 | 83 | data.B.imm1_4 = bitSlice(value, 4, 1); |
| 84 | 84 | data.B.imm5_10 = bitSlice(value, 10, 5); |
| 85 | 85 | data.B.imm11 = bitSlice(value, 11, 11); |