std.builtin: rename Type.UnionField and Type.StructField's field_type to type
This commit is contained in:
@@ -9,7 +9,7 @@ pub export fn entry() void {
|
||||
const info = @typeInfo(Widget).Union;
|
||||
inline for (info.fields) |field| {
|
||||
if (foo()) {
|
||||
switch (field.field_type) {
|
||||
switch (field.type) {
|
||||
u0 => a = 2,
|
||||
else => unreachable,
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ fn parseFree(comptime T: type, value: T, allocator: std.mem.Allocator) void {
|
||||
.Struct => |structInfo| {
|
||||
inline for (structInfo.fields) |field| {
|
||||
if (!field.is_comptime)
|
||||
parseFree(field.field_type, undefined, allocator);
|
||||
parseFree(field.type, undefined, allocator);
|
||||
}
|
||||
},
|
||||
.Pointer => |ptrInfo| {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export fn entry() void {
|
||||
_ = @Type(.{ .Struct = .{ .layout = .Packed, .fields = &.{
|
||||
.{ .name = "one", .field_type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
|
||||
.{ .name = "one", .type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
|
||||
}, .decls = &.{}, .is_tuple = false } });
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ comptime {
|
||||
.layout = .Auto,
|
||||
.fields = &.{.{
|
||||
.name = "foo",
|
||||
.field_type = u32,
|
||||
.type = u32,
|
||||
.default_value = null,
|
||||
.is_comptime = false,
|
||||
.alignment = 4,
|
||||
@@ -17,7 +17,7 @@ comptime {
|
||||
.layout = .Auto,
|
||||
.fields = &.{.{
|
||||
.name = "3",
|
||||
.field_type = u32,
|
||||
.type = u32,
|
||||
.default_value = null,
|
||||
.is_comptime = false,
|
||||
.alignment = 4,
|
||||
@@ -31,7 +31,7 @@ comptime {
|
||||
.layout = .Auto,
|
||||
.fields = &.{.{
|
||||
.name = "0",
|
||||
.field_type = u32,
|
||||
.type = u32,
|
||||
.default_value = null,
|
||||
.is_comptime = true,
|
||||
.alignment = 4,
|
||||
@@ -45,7 +45,7 @@ comptime {
|
||||
.layout = .Extern,
|
||||
.fields = &.{.{
|
||||
.name = "0",
|
||||
.field_type = u32,
|
||||
.type = u32,
|
||||
.default_value = null,
|
||||
.is_comptime = true,
|
||||
.alignment = 4,
|
||||
@@ -59,7 +59,7 @@ comptime {
|
||||
.layout = .Packed,
|
||||
.fields = &.{.{
|
||||
.name = "0",
|
||||
.field_type = u32,
|
||||
.type = u32,
|
||||
.default_value = null,
|
||||
.is_comptime = true,
|
||||
.alignment = 4,
|
||||
|
||||
@@ -16,8 +16,8 @@ const Tagged = @Type(.{
|
||||
.layout = .Auto,
|
||||
.tag_type = Tag,
|
||||
.fields = &.{
|
||||
.{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
|
||||
.{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
|
||||
.{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
|
||||
.{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
|
||||
},
|
||||
.decls = &.{},
|
||||
},
|
||||
|
||||
@@ -15,9 +15,9 @@ const Tagged = @Type(.{
|
||||
.layout = .Auto,
|
||||
.tag_type = Tag,
|
||||
.fields = &.{
|
||||
.{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
|
||||
.{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
|
||||
.{ .name = "arst", .field_type = f32, .alignment = @alignOf(f32) },
|
||||
.{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
|
||||
.{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
|
||||
.{ .name = "arst", .type = f32, .alignment = @alignOf(f32) },
|
||||
},
|
||||
.decls = &.{},
|
||||
},
|
||||
|
||||
@@ -3,7 +3,7 @@ const Untagged = @Type(.{
|
||||
.layout = .Auto,
|
||||
.tag_type = null,
|
||||
.fields = &.{
|
||||
.{ .name = "foo", .field_type = opaque {}, .alignment = 1 },
|
||||
.{ .name = "foo", .type = opaque {}, .alignment = 1 },
|
||||
},
|
||||
.decls = &.{},
|
||||
},
|
||||
@@ -17,4 +17,4 @@ export fn entry() usize {
|
||||
// target=native
|
||||
//
|
||||
// :1:18: error: opaque types have unknown size and therefore cannot be directly embedded in unions
|
||||
// :6:45: note: opaque declared here
|
||||
// :6:39: note: opaque declared here
|
||||
|
||||
Reference in New Issue
Block a user