diff options
| author | daurnimator <quae@daurnimator.com> | 2020-12-13 22:27:33 +1100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-01-01 15:48:48 -0700 |
| commit | 4387e50d4fa058ebc064ec8bfae07ef78774a2f4 (patch) | |
| tree | 529c41d1b15362a534dc002295ca0d6fcd5b6b69 /lib/std | |
| parent | 9c97a07f18413fb0a535bc89ea9aecd1656cda6a (diff) | |
| download | zig-4387e50d4fa058ebc064ec8bfae07ef78774a2f4.tar.gz zig-4387e50d4fa058ebc064ec8bfae07ef78774a2f4.zip | |
std: use FieldEnum from TrailerFlags
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/meta/trailer_flags.zig | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/std/meta/trailer_flags.zig b/lib/std/meta/trailer_flags.zig index 40fbc57dfe..09c75b3d78 100644 --- a/lib/std/meta/trailer_flags.zig +++ b/lib/std/meta/trailer_flags.zig @@ -21,20 +21,7 @@ pub fn TrailerFlags(comptime Fields: type) type { pub const Int = meta.Int(.unsigned, bit_count); pub const bit_count = @typeInfo(Fields).Struct.fields.len; - pub const FieldEnum = blk: { - comptime var fields: [bit_count]TypeInfo.EnumField = undefined; - inline for (@typeInfo(Fields).Struct.fields) |struct_field, i| - fields[i] = .{ .name = struct_field.name, .value = i }; - break :blk @Type(.{ - .Enum = .{ - .layout = .Auto, - .tag_type = std.math.IntFittingRange(0, bit_count - 1), - .fields = &fields, - .decls = &[_]TypeInfo.Declaration{}, - .is_exhaustive = true, - }, - }); - }; + pub const FieldEnum = std.meta.FieldEnum(Fields); pub const InitStruct = blk: { comptime var fields: [bit_count]TypeInfo.StructField = undefined; |
