aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorCarl Åstholm <carl@astholm.se>2024-01-07 15:52:24 +0100
committerCarl Åstholm <carl@astholm.se>2024-01-07 16:21:08 +0100
commitc8fa767f083e610840cef688b709783c5ad66acc (patch)
tree3b5e75ba381e722eb1e2c8cbc44d1df870b534dd /lib/std
parenta02bd81760166d679ccee0e190bf62115272ffbe (diff)
downloadzig-c8fa767f083e610840cef688b709783c5ad66acc.tar.gz
zig-c8fa767f083e610840cef688b709783c5ad66acc.zip
Work around stage1 not yet returning null-terminated `@typeInfo` strings
These changes can be reverted the next time stage1 is updated.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/enums.zig2
-rw-r--r--lib/std/io.zig2
-rw-r--r--lib/std/meta.zig4
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/enums.zig b/lib/std/enums.zig
index 839781ffb7..872b752a40 100644
--- a/lib/std/enums.zig
+++ b/lib/std/enums.zig
@@ -14,7 +14,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
var fields: []const StructField = &[_]StructField{};
for (std.meta.fields(E)) |field| {
fields = fields ++ &[_]StructField{.{
- .name = field.name,
+ .name = field.name ++ "",
.type = Data,
.default_value = if (field_default) |d| @as(?*const anyopaque, @ptrCast(&d)) else null,
.is_comptime = false,
diff --git a/lib/std/io.zig b/lib/std/io.zig
index e19b2e0e16..912e834a75 100644
--- a/lib/std/io.zig
+++ b/lib/std/io.zig
@@ -635,7 +635,7 @@ pub fn PollFiles(comptime StreamEnum: type) type {
var struct_fields: [enum_fields.len]std.builtin.Type.StructField = undefined;
for (&struct_fields, enum_fields) |*struct_field, enum_field| {
struct_field.* = .{
- .name = enum_field.name,
+ .name = enum_field.name ++ "",
.type = fs.File,
.default_value = null,
.is_comptime = false,
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 5531242e30..41b3ca291f 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -556,7 +556,7 @@ pub fn FieldEnum(comptime T: type) type {
var decls = [_]std.builtin.Type.Declaration{};
inline for (field_infos, 0..) |field, i| {
enumFields[i] = .{
- .name = field.name,
+ .name = field.name ++ "",
.value = i,
};
}
@@ -628,7 +628,7 @@ pub fn DeclEnum(comptime T: type) type {
var enumDecls: [fieldInfos.len]std.builtin.Type.EnumField = undefined;
var decls = [_]std.builtin.Type.Declaration{};
inline for (fieldInfos, 0..) |field, i| {
- enumDecls[i] = .{ .name = field.name, .value = i };
+ enumDecls[i] = .{ .name = field.name ++ "", .value = i };
}
return @Type(.{
.Enum = .{