mirror of
https://github.com/ziglang/zig.git
synced 2025-12-12 17:23:09 +00:00
Work around stage1 not yet returning null-terminated @typeInfo strings
These changes can be reverted the next time stage1 is updated.
This commit is contained in:
parent
a02bd81760
commit
c8fa767f08
2
deps/aro/aro/Attribute.zig
vendored
2
deps/aro/aro/Attribute.zig
vendored
@ -645,7 +645,7 @@ pub const Arguments = blk: {
|
|||||||
var union_fields: [decls.len]ZigType.UnionField = undefined;
|
var union_fields: [decls.len]ZigType.UnionField = undefined;
|
||||||
for (decls, &union_fields) |decl, *field| {
|
for (decls, &union_fields) |decl, *field| {
|
||||||
field.* = .{
|
field.* = .{
|
||||||
.name = decl.name,
|
.name = decl.name ++ "",
|
||||||
.type = @field(attributes, decl.name),
|
.type = @field(attributes, decl.name),
|
||||||
.alignment = 0,
|
.alignment = 0,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,7 +14,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
|
|||||||
var fields: []const StructField = &[_]StructField{};
|
var fields: []const StructField = &[_]StructField{};
|
||||||
for (std.meta.fields(E)) |field| {
|
for (std.meta.fields(E)) |field| {
|
||||||
fields = fields ++ &[_]StructField{.{
|
fields = fields ++ &[_]StructField{.{
|
||||||
.name = field.name,
|
.name = field.name ++ "",
|
||||||
.type = Data,
|
.type = Data,
|
||||||
.default_value = if (field_default) |d| @as(?*const anyopaque, @ptrCast(&d)) else null,
|
.default_value = if (field_default) |d| @as(?*const anyopaque, @ptrCast(&d)) else null,
|
||||||
.is_comptime = false,
|
.is_comptime = false,
|
||||||
|
|||||||
@ -635,7 +635,7 @@ pub fn PollFiles(comptime StreamEnum: type) type {
|
|||||||
var struct_fields: [enum_fields.len]std.builtin.Type.StructField = undefined;
|
var struct_fields: [enum_fields.len]std.builtin.Type.StructField = undefined;
|
||||||
for (&struct_fields, enum_fields) |*struct_field, enum_field| {
|
for (&struct_fields, enum_fields) |*struct_field, enum_field| {
|
||||||
struct_field.* = .{
|
struct_field.* = .{
|
||||||
.name = enum_field.name,
|
.name = enum_field.name ++ "",
|
||||||
.type = fs.File,
|
.type = fs.File,
|
||||||
.default_value = null,
|
.default_value = null,
|
||||||
.is_comptime = false,
|
.is_comptime = false,
|
||||||
|
|||||||
@ -556,7 +556,7 @@ pub fn FieldEnum(comptime T: type) type {
|
|||||||
var decls = [_]std.builtin.Type.Declaration{};
|
var decls = [_]std.builtin.Type.Declaration{};
|
||||||
inline for (field_infos, 0..) |field, i| {
|
inline for (field_infos, 0..) |field, i| {
|
||||||
enumFields[i] = .{
|
enumFields[i] = .{
|
||||||
.name = field.name,
|
.name = field.name ++ "",
|
||||||
.value = i,
|
.value = i,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -628,7 +628,7 @@ pub fn DeclEnum(comptime T: type) type {
|
|||||||
var enumDecls: [fieldInfos.len]std.builtin.Type.EnumField = undefined;
|
var enumDecls: [fieldInfos.len]std.builtin.Type.EnumField = undefined;
|
||||||
var decls = [_]std.builtin.Type.Declaration{};
|
var decls = [_]std.builtin.Type.Declaration{};
|
||||||
inline for (fieldInfos, 0..) |field, i| {
|
inline for (fieldInfos, 0..) |field, i| {
|
||||||
enumDecls[i] = .{ .name = field.name, .value = i };
|
enumDecls[i] = .{ .name = field.name ++ "", .value = i };
|
||||||
}
|
}
|
||||||
return @Type(.{
|
return @Type(.{
|
||||||
.Enum = .{
|
.Enum = .{
|
||||||
|
|||||||
@ -4050,7 +4050,7 @@ pub const Value = struct {
|
|||||||
const tags = @typeInfo(Tag).Enum.fields;
|
const tags = @typeInfo(Tag).Enum.fields;
|
||||||
var fields: [tags.len]std.builtin.Type.StructField = undefined;
|
var fields: [tags.len]std.builtin.Type.StructField = undefined;
|
||||||
for (&fields, tags) |*field, t| field.* = .{
|
for (&fields, tags) |*field, t| field.* = .{
|
||||||
.name = t.name,
|
.name = t.name ++ "",
|
||||||
.type = *@field(Tag, t.name).Type(),
|
.type = *@field(Tag, t.name).Type(),
|
||||||
.default_value = null,
|
.default_value = null,
|
||||||
.is_comptime = false,
|
.is_comptime = false,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user