From ceff03f3e96a9c51dc24e21b1f343f2b2650e2aa Mon Sep 17 00:00:00 2001 From: r00ster91 Date: Fri, 16 Dec 2022 18:05:21 +0100 Subject: std.builtin: remove layout field from Type.Enum --- lib/std/meta.zig | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'lib/std/meta.zig') 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, @@ -676,10 +669,6 @@ pub fn FieldEnum(comptime T: type) type { 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, -- cgit v1.2.3