std: update std.builtin.Type fields to follow naming conventions

The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
This commit is contained in:
mlugg
2024-08-28 02:35:53 +01:00
parent 1a178d4995
commit 0fe3fd01dd
336 changed files with 4105 additions and 4112 deletions

View File

@@ -24,10 +24,9 @@ pub fn MultiArrayList(comptime T: type) type {
capacity: usize = 0,
const Elem = switch (@typeInfo(T)) {
.Struct => T,
.Union => |u| struct {
pub const Bare =
@Type(.{ .Union = .{
.@"struct" => T,
.@"union" => |u| struct {
pub const Bare = @Type(.{ .@"union" = .{
.layout = u.layout,
.tag_type = null,
.fields = u.fields,
@@ -84,8 +83,8 @@ pub fn MultiArrayList(comptime T: type) type {
pub fn set(self: *Slice, index: usize, elem: T) void {
const e = switch (@typeInfo(T)) {
.Struct => elem,
.Union => Elem.fromT(elem),
.@"struct" => elem,
.@"union" => Elem.fromT(elem),
else => unreachable,
};
inline for (fields, 0..) |field_info, i| {
@@ -99,8 +98,8 @@ pub fn MultiArrayList(comptime T: type) type {
@field(result, field_info.name) = self.items(@as(Field, @enumFromInt(i)))[index];
}
return switch (@typeInfo(T)) {
.Struct => result,
.Union => Elem.toT(result.tags, result.data),
.@"struct" => result,
.@"union" => Elem.toT(result.tags, result.data),
else => unreachable,
};
}
@@ -287,8 +286,8 @@ pub fn MultiArrayList(comptime T: type) type {
assert(index <= self.len);
self.len += 1;
const entry = switch (@typeInfo(T)) {
.Struct => elem,
.Union => Elem.fromT(elem),
.@"struct" => elem,
.@"union" => Elem.fromT(elem),
else => unreachable,
};
const slices = self.slice();
@@ -557,7 +556,7 @@ pub fn MultiArrayList(comptime T: type) type {
.is_comptime = fields[i].is_comptime,
.alignment = fields[i].alignment,
};
break :entry @Type(.{ .Struct = .{
break :entry @Type(.{ .@"struct" = .{
.layout = .@"extern",
.fields = &entry_fields,
.decls = &.{},