diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-08-28 02:35:53 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-08-28 08:39:59 +0100 |
| commit | 0fe3fd01ddc2cd49c6a2b939577d16b9d2c65ea9 (patch) | |
| tree | 2c07fddf2b6230360fe618c4de192bc2d24eeaf7 /lib/std/multi_array_list.zig | |
| parent | 1a178d499537b922ff05c5d0186ed5a00dbb1a9b (diff) | |
| download | zig-0fe3fd01ddc2cd49c6a2b939577d16b9d2c65ea9.tar.gz zig-0fe3fd01ddc2cd49c6a2b939577d16b9d2c65ea9.zip | |
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.
Diffstat (limited to 'lib/std/multi_array_list.zig')
| -rw-r--r-- | lib/std/multi_array_list.zig | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig index cfe77f11b5..0d9272d492 100644 --- a/lib/std/multi_array_list.zig +++ b/lib/std/multi_array_list.zig @@ -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 = &.{}, |
