From 6d67c0f876bf79e6b6720343f836637fb26cf62e Mon Sep 17 00:00:00 2001 From: Eric Joldasov Date: Sun, 9 Feb 2025 14:03:13 +0500 Subject: [PATCH] update to new names in `std.builtin.Type` See https://github.com/ziglang/zig/pull/21225 . Signed-off-by: Eric Joldasov --- src/bin_export.zig | 2 +- src/bin_reader.zig | 2 +- src/ui.zig | 2 +- src/util.zig | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin_export.zig b/src/bin_export.zig index 72140c7..4c445cf 100644 --- a/src/bin_export.zig +++ b/src/bin_export.zig @@ -51,7 +51,7 @@ pub const ItemKey = enum(u5) { // Pessimistic upper bound on the encoded size of an item, excluding the name field. // 2 bytes for map start/end, 11 per field (2 for the key, 9 for a full u64). -const MAX_ITEM_LEN = 2 + 11 * @typeInfo(ItemKey).Enum.fields.len; +const MAX_ITEM_LEN = 2 + 11 * @typeInfo(ItemKey).@"enum".fields.len; pub const CborMajor = enum(u3) { pos, neg, bytes, text, array, map, tag, simple }; diff --git a/src/bin_reader.zig b/src/bin_reader.zig index b916661..f0ea4b4 100644 --- a/src/bin_reader.zig +++ b/src/bin_reader.zig @@ -338,7 +338,7 @@ const ItemParser = struct { // Skips over any fields that don't fit into an ItemKey. fn next(r: *ItemParser) ?Field { while (r.key()) |k| { - if (k.major == .pos and k.arg <= std.math.maxInt(@typeInfo(ItemKey).Enum.tag_type)) return .{ + if (k.major == .pos and k.arg <= std.math.maxInt(@typeInfo(ItemKey).@"enum".tag_type)) return .{ .key = @enumFromInt(k.arg), .val = r.r.next(), } else { diff --git a/src/ui.zig b/src/ui.zig index cb48df7..a7cd180 100644 --- a/src/ui.zig +++ b/src/ui.zig @@ -288,7 +288,7 @@ pub const Style = lbl: { }; } break :lbl @Type(.{ - .Enum = .{ + .@"enum" = .{ .tag_type = u8, .fields = &fields, .decls = &[_]std.builtin.Type.Declaration{}, diff --git a/src/util.zig b/src/util.zig index 443983b..77ee73b 100644 --- a/src/util.zig +++ b/src/util.zig @@ -18,8 +18,8 @@ pub fn castClamp(comptime T: type, x: anytype) T { // Cast any integer type to the target type, truncating if necessary. pub fn castTruncate(comptime T: type, x: anytype) T { - const Ti = @typeInfo(T).Int; - const Xi = @typeInfo(@TypeOf(x)).Int; + const Ti = @typeInfo(T).int; + const Xi = @typeInfo(@TypeOf(x)).int; const nx: std.meta.Int(Ti.signedness, Xi.bits) = @bitCast(x); return if (Xi.bits > Ti.bits) @truncate(nx) else nx; }