all: update to std.builtin.Type.{Pointer,Array,StructField} field renames

This commit is contained in:
mlugg
2025-01-15 17:34:12 +00:00
parent 89a9cabafd
commit 9804cc8bc6
26 changed files with 117 additions and 153 deletions

View File

@@ -7,7 +7,7 @@ export fn entry() void {
.address_space = .generic,
.child = u8,
.is_allowzero = false,
.sentinel = &@as(u8, 0),
.sentinel_ptr = &@as(u8, 0),
} });
}

View File

@@ -12,7 +12,7 @@ comptime {
}
comptime {
_ = @Type(.{ .array = .{ .child = S, .len = 0, .sentinel = &sentinel } });
_ = @Type(.{ .array = .{ .child = S, .len = 0, .sentinel_ptr = &sentinel } });
}
comptime {
_ = @Type(.{ .pointer = .{
@@ -23,7 +23,7 @@ comptime {
.address_space = .generic,
.child = S,
.is_allowzero = false,
.sentinel = &sentinel,
.sentinel_ptr = &sentinel,
} });
}
comptime {
@@ -35,7 +35,7 @@ comptime {
.address_space = .generic,
.child = S,
.is_allowzero = false,
.sentinel = &sentinel,
.sentinel_ptr = &sentinel,
} });
}

View File

@@ -1,11 +1,9 @@
export fn entry() void {
_ = @Type(.{ .@"struct" = .{ .layout = .@"packed", .fields = &.{
.{ .name = "one", .type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
.{ .name = "one", .type = u4, .default_value_ptr = null, .is_comptime = false, .alignment = 2 },
}, .decls = &.{}, .is_tuple = false } });
}
// error
// backend=stage2
// target=native
//
// :2:9: error: alignment in a packed struct field must be set to 0

View File

@@ -4,7 +4,7 @@ comptime {
.fields = &.{.{
.name = "foo",
.type = u32,
.default_value = null,
.default_value_ptr = null,
.is_comptime = false,
.alignment = 4,
}},
@@ -18,7 +18,7 @@ comptime {
.fields = &.{.{
.name = "3",
.type = u32,
.default_value = null,
.default_value_ptr = null,
.is_comptime = false,
.alignment = 4,
}},
@@ -32,7 +32,7 @@ comptime {
.fields = &.{.{
.name = "0",
.type = u32,
.default_value = null,
.default_value_ptr = null,
.is_comptime = true,
.alignment = 4,
}},
@@ -46,7 +46,7 @@ comptime {
.fields = &.{.{
.name = "0",
.type = u32,
.default_value = null,
.default_value_ptr = null,
.is_comptime = true,
.alignment = 4,
}},
@@ -60,7 +60,7 @@ comptime {
.fields = &.{.{
.name = "0",
.type = u32,
.default_value = null,
.default_value_ptr = null,
.is_comptime = true,
.alignment = 4,
}},
@@ -70,8 +70,6 @@ comptime {
}
// error
// backend=stage2
// target=native
//
// :2:5: error: tuple cannot have non-numeric field 'foo'
// :16:5: error: tuple field name '3' does not match field index 0

View File

@@ -17,7 +17,7 @@ comptime {
.fields = &.{.{
.name = "0",
.type = u32,
.default_value = null,
.default_value_ptr = null,
.is_comptime = true,
.alignment = 5,
}},
@@ -36,7 +36,7 @@ comptime {
.address_space = .generic,
.child = u8,
.is_allowzero = false,
.sentinel = null,
.sentinel_ptr = null,
},
});
}

View File

@@ -1,5 +1,5 @@
comptime {
_ = @Type(.{ .array = .{ .len = 0, .child = u8, .sentinel = undefined } });
_ = @Type(.{ .array = .{ .len = 0, .child = u8, .sentinel_ptr = undefined } });
}
comptime {
_ = @Type(.{