diff options
| author | r00ster91 <r00ster91@proton.me> | 2022-12-16 18:05:21 +0100 |
|---|---|---|
| committer | r00ster91 <r00ster91@proton.me> | 2022-12-18 13:31:38 +0100 |
| commit | ceff03f3e96a9c51dc24e21b1f343f2b2650e2aa (patch) | |
| tree | 68390ee9675cbaabe61892a879af0840293c66f8 /lib | |
| parent | aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6 (diff) | |
| download | zig-ceff03f3e96a9c51dc24e21b1f343f2b2650e2aa.tar.gz zig-ceff03f3e96a9c51dc24e21b1f343f2b2650e2aa.zip | |
std.builtin: remove layout field from Type.Enum
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/builtin.zig | 2 | ||||
| -rw-r--r-- | lib/std/meta.zig | 14 | ||||
| -rw-r--r-- | lib/std/meta/trait.zig | 2 |
3 files changed, 1 insertions, 17 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 349d976ddc..a0b3011d5c 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -330,8 +330,6 @@ pub const Type = union(enum) { /// This data structure is used by the Zig language code generation and /// therefore must be kept in sync with the compiler implementation. pub const Enum = struct { - /// TODO enums should no longer have this field in type info. - layout: ContainerLayout, tag_type: type, fields: []const EnumField, decls: []const Declaration, diff --git a/lib/std/meta.zig b/lib/std/meta.zig index b4a73ffb3a..39d561469f 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -371,16 +371,12 @@ test "std.meta.assumeSentinel" { pub fn containerLayout(comptime T: type) Type.ContainerLayout { return switch (@typeInfo(T)) { .Struct => |info| info.layout, - .Enum => |info| info.layout, .Union => |info| info.layout, - else => @compileError("Expected struct, enum or union type, found '" ++ @typeName(T) ++ "'"), + else => @compileError("expected struct or union type, found '" ++ @typeName(T) ++ "'"), }; } test "std.meta.containerLayout" { - const E1 = enum { - A, - }; const S1 = struct {}; const S2 = packed struct {}; const S3 = extern struct {}; @@ -394,7 +390,6 @@ test "std.meta.containerLayout" { a: u8, }; - try testing.expect(containerLayout(E1) == .Auto); try testing.expect(containerLayout(S1) == .Auto); try testing.expect(containerLayout(S2) == .Packed); try testing.expect(containerLayout(S3) == .Extern); @@ -634,7 +629,6 @@ pub fn FieldEnum(comptime T: type) type { if (field_infos.len == 0) { return @Type(.{ .Enum = .{ - .layout = .Auto, .tag_type = u0, .fields = &.{}, .decls = &.{}, @@ -664,7 +658,6 @@ pub fn FieldEnum(comptime T: type) type { } return @Type(.{ .Enum = .{ - .layout = .Auto, .tag_type = std.math.IntFittingRange(0, field_infos.len - 1), .fields = &enumFields, .decls = &decls, @@ -677,10 +670,6 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void { // TODO: https://github.com/ziglang/zig/issues/7419 // testing.expectEqual(@typeInfo(expected).Enum, @typeInfo(actual).Enum); try testing.expectEqual( - @typeInfo(expected).Enum.layout, - @typeInfo(actual).Enum.layout, - ); - try testing.expectEqual( @typeInfo(expected).Enum.tag_type, @typeInfo(actual).Enum.tag_type, ); @@ -740,7 +729,6 @@ pub fn DeclEnum(comptime T: type) type { } return @Type(.{ .Enum = .{ - .layout = .Auto, .tag_type = std.math.IntFittingRange(0, fieldInfos.len - 1), .fields = &enumDecls, .decls = &decls, diff --git a/lib/std/meta/trait.zig b/lib/std/meta/trait.zig index 73d1292406..843ada7f56 100644 --- a/lib/std/meta/trait.zig +++ b/lib/std/meta/trait.zig @@ -154,7 +154,6 @@ pub fn isExtern(comptime T: type) bool { return switch (@typeInfo(T)) { .Struct => |s| s.layout == .Extern, .Union => |u| u.layout == .Extern, - .Enum => |e| e.layout == .Extern, else => false, }; } @@ -172,7 +171,6 @@ pub fn isPacked(comptime T: type) bool { return switch (@typeInfo(T)) { .Struct => |s| s.layout == .Packed, .Union => |u| u.layout == .Packed, - .Enum => |e| e.layout == .Packed, else => false, }; } |
