╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ────╮ │src/event.zig│ ╰─────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2090 } │ │2091 │ │2092 fn assertFieldSubset(comptime Sub: type, comptime Full: type) void { │ │2091 - for (@typeInfo(Sub).@"struct".fields) |field| { │ │2092 - if (!@hasField(Full, field.name)) @compileError(@typeName(Full) ++ " has no field " ++ field.name);│ │2093 - const FullField = @FieldType(Full, field.name); │ │2094 - if (@typeInfo(field.type) == .@"struct") { │ │2095 - assertFieldSubset(field.type, FullField); │ │2096 - } else if (field.type != FullField) { │ │2097 - @compileError(@typeName(Full) ++ "." ++ field.name ++ " is a " ++ @typeName(FullField)); │ │2093 + const info = @typeInfo(Sub).@"struct"; │ │2094 + for (info.field_names, info.field_types) |field_name, field_type| { │ │2095 + if (!@hasField(Full, field_name)) @compileError(@typeName(Full) ++ " has no field " ++ field_name);│ │2096 + const FullField = @FieldType(Full, field_name); │ │2097 + if (@typeInfo(field_type) == .@"struct") { │ │2098 + assertFieldSubset(field_type, FullField); │ │2099 + } else if (field_type != FullField) { │ │2100 + @compileError(@typeName(Full) ++ "." ++ field_name ++ " is a " ++ @typeName(FullField)); │ │2101 } │ │2102 } │ │2103 } │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2112 var event: T = undefined; │ │2113 switch (@typeInfo(T)) { │ │2114 .@"struct" => |struct_info| { │ │2112 - inline for (struct_info.fields) |field| { │ │2113 - const cursor = try map.getCursor(hash.hashInt(hash_kind, field.name)); │ │2114 - @field(event, field.name) = try readField(field.type, DB, hash_kind, arena, cursor);│ │2115 + inline for (struct_info.field_names, struct_info.field_types) |field_name, field_type| {│ │2116 + const cursor = try map.getCursor(hash.hashInt(hash_kind, field_name)); │ │2117 + @field(event, field_name) = try readField(field_type, DB, hash_kind, arena, cursor);│ │2118 } │ │2119 }, │ │2120 else => @compileError("read expects a struct"), │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2138 const cursor = cursor_maybe orelse return error.NotFound; │ │2139 switch (@typeInfo(Field)) { │ │2140 .pointer => |pointer_info| { │ │2138 - if (pointer_info.size != .slice or pointer_info.child != u8 or !pointer_info.is_const) { │ │2141 + if (pointer_info.size != .slice or pointer_info.child != u8 or !pointer_info.attrs.@"const") {│ │2142 @compileError("unsupported read field type: " ++ @typeName(Field)); │ │2143 } │ │2144 return try cursor.readBytesAlloc(arena.allocator(), null); │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2168 switch (cursor.slot().tag) { │ │2169 .bytes, .short_bytes => { │ │2170 const name = try cursor.readBytesAlloc(arena.allocator(), null); │ │2168 - inline for (union_info.fields) |variant| { │ │2169 - if (variant.type == void and std.mem.eql(u8, name, variant.name)) { │ │2170 - return @unionInit(Field, variant.name, {}); │ │2171 + inline for (union_info.field_names, union_info.field_types) |variant_name, variant_type| {│ │2172 + if (variant_type == void and std.mem.eql(u8, name, variant_name)) { │ │2173 + return @unionInit(Field, variant_name, {}); │ │2174 } │ │2175 } │ │2176 return error.InvalidUnion; │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2181 const entry = (try iter.next()) orelse return error.InvalidUnion; │ │2182 const pair = try entry.readKeyValuePair(); │ │2183 if (try iter.next() != null) return error.InvalidUnion; │ │2181 - inline for (union_info.fields) |variant| { │ │2182 - if (variant.type != void and pair.hash == hash.hashInt(hash_kind, variant.name)) { │ │2183 - return @unionInit(Field, variant.name, try readField(variant.type, DB, hash_kind, arena, pair.value_cursor));│ │2184 + inline for (union_info.field_names, union_info.field_types) |variant_name, variant_type| { │ │2185 + if (variant_type != void and pair.hash == hash.hashInt(hash_kind, variant_name)) { │ │2186 + return @unionInit(Field, variant_name, try readField(variant_type, DB, hash_kind, arena, pair.value_cursor));│ │2187 } │ │2188 } │ │2189 return error.InvalidUnion; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2200 fn fieldsEqual(comptime T: type, a: T, b: T) bool { │ │2201 switch (@typeInfo(T)) { │ │2202 .@"struct" => |struct_info| { │ │2200 - inline for (struct_info.fields) |field| { │ │2201 - if (!fieldEqual(field.type, @field(a, field.name), @field(b, field.name))) return false;│ │2203 + inline for (struct_info.field_names, struct_info.field_types) |field_name, field_type| { │ │2204 + if (!fieldEqual(field_type, @field(a, field_name), @field(b, field_name))) return false;│ │2205 } │ │2206 }, │ │2207 else => @compileError("fieldsEqual expects a struct"), │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2259 ) !void { │ │2260 switch (@typeInfo(T)) { │ │2261 .@"struct" => |struct_info| { │ │2259 - inline for (struct_info.fields) |field| { │ │2260 - try upsertField(DB, hash_kind, map, field.name, field.type, @field(event, field.name));│ │2262 + inline for (struct_info.field_names, struct_info.field_types) |field_name, field_type| { │ │2263 + try upsertField(DB, hash_kind, map, field_name, field_type, @field(event, field_name));│ │2264 } │ │2265 }, │ │2266 else => @compileError("upsert expects a struct"), │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────╮ │src/event/Issue.zig│ ╰───────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────╮ │28 │ │29 const longest_len = blk: { │ │30 var len: usize = 0; │ │31 - for (@typeInfo(Status).@"enum".fields) |field| len = @max(len, field.name.len);│ │31 + for (@typeInfo(Status).@"enum".field_names) |name| len = @max(len, name.len); │ │32 break :blk len; │ │33 }; │ │34 }; │ ╰───────────────────────────────────────────────────────────────────────────────────────────╯ ╭ changed ──────────╮ │src/event/Patch.zig│ ╰───────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │57 │ │58 const longest_len = blk: { │ │59 var len: usize = 0; │ │60 - for (@typeInfo(StatusKind).@"enum".fields) |field| len = @max(len, field.name.len);│ │60 + for (@typeInfo(StatusKind).@"enum".field_names) |name| len = @max(len, name.len); │ │61 break :blk len; │ │62 }; │ │63 }; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │286 target: Self, │ │287 parent: Self, │ │288 merged: *Self, │ │289 - outcome: *[std.meta.fields(Self).len]evt.FieldMerge, │ │289 + outcome: *[@typeInfo(Self).@"struct".field_names.len]evt.FieldMerge, │ │290 ) void { │ │291 const status_index = std.meta.fieldIndex(Self, "status") orelse @compileError("Patch.status not found"); │ │292 const revision_index = std.meta.fieldIndex(Self, "revision") orelse @compileError("Patch.revision not found");│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────╮ │next →│ ╰──────╯