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/std/meta.zig | |
| parent | aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6 (diff) | |
| download | zig-ceff03f3e96a9c51dc24e21b1f343f2b2650e2aa.tar.gz zig-ceff03f3e96a9c51dc24e21b1f343f2b2650e2aa.zip | |
std.builtin: remove layout field from Type.Enum
Diffstat (limited to 'lib/std/meta.zig')
| -rw-r--r-- | lib/std/meta.zig | 14 |
1 files changed, 1 insertions, 13 deletions
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, |
