Skip to content

Commit 0fe3fd0

Browse files
committed
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 ziglang#9938.
1 parent 1a178d4 commit 0fe3fd0

File tree

336 files changed

+4107
-4114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+4107
-4114
lines changed

doc/langref.html.in

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4299,7 +4299,7 @@ comptime {
42994299
Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}.
43004300
</p>
43014301
<p>
4302-
Asserts that {#syntax#}@typeInfo(DestType) != .Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@ptrFromInt{#endsyntax#} if you need this.
4302+
Asserts that {#syntax#}@typeInfo(DestType) != .pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@ptrFromInt{#endsyntax#} if you need this.
43034303
</p>
43044304
<p>
43054305
Can be used for these things for example:
@@ -4517,7 +4517,7 @@ comptime {
45174517
{#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float,
45184518
an integer or an enum.
45194519
</p>
4520-
<p>{#syntax#}@typeInfo(@TypeOf(ptr)).Pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
4520+
<p>{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
45214521
<p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
45224522
{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@fence|@cmpxchgWeak#}
45234523
{#header_close#}
@@ -4549,7 +4549,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
45494549
{#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float,
45504550
an integer or an enum.
45514551
</p>
4552-
<p>{#syntax#}@typeInfo(@TypeOf(ptr)).Pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
4552+
<p>{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
45534553
<p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
45544554
{#see_also|@atomicStore|@atomicLoad|@atomicRmw|@fence|@cmpxchgStrong#}
45554555
{#header_close#}
@@ -4672,7 +4672,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
46724672
<p>
46734673
Floored division. Rounds toward negative infinity. For unsigned integers it is
46744674
the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and
4675-
{#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
4675+
{#syntax#}!(@typeInfo(T) == .int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
46764676
</p>
46774677
<ul>
46784678
<li>{#syntax#}@divFloor(-5, 3) == -2{#endsyntax#}</li>
@@ -4686,7 +4686,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
46864686
<p>
46874687
Truncated division. Rounds toward zero. For unsigned integers it is
46884688
the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and
4689-
{#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
4689+
{#syntax#}!(@typeInfo(T) == .int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
46904690
</p>
46914691
<ul>
46924692
<li>{#syntax#}@divTrunc(-5, 3) == -1{#endsyntax#}</li>
@@ -5320,8 +5320,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
53205320
any bits that disagree with the resultant sign bit are shifted out.
53215321
</p>
53225322
<p>
5323-
The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).Int.bits){#endsyntax#} bits.
5324-
This is because {#syntax#}shift_amt >= @typeInfo(T).Int.bits{#endsyntax#} is undefined behavior.
5323+
The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).int.bits){#endsyntax#} bits.
5324+
This is because {#syntax#}shift_amt >= @typeInfo(T).int.bits{#endsyntax#} is undefined behavior.
53255325
</p>
53265326
<p>
53275327
{#syntax#}comptime_int{#endsyntax#} is modeled as an integer with an infinite number of bits,
@@ -5337,8 +5337,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
53375337
Performs {#syntax#}a << b{#endsyntax#} and returns a tuple with the result and a possible overflow bit.
53385338
</p>
53395339
<p>
5340-
The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(@TypeOf(a)).Int.bits){#endsyntax#} bits.
5341-
This is because {#syntax#}shift_amt >= @typeInfo(@TypeOf(a)).Int.bits{#endsyntax#} is undefined behavior.
5340+
The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(@TypeOf(a)).int.bits){#endsyntax#} bits.
5341+
This is because {#syntax#}shift_amt >= @typeInfo(@TypeOf(a)).int.bits{#endsyntax#} is undefined behavior.
53425342
</p>
53435343
{#see_also|@shlExact|@shrExact#}
53445344
{#header_close#}
@@ -5350,8 +5350,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
53505350
that the shift will not shift any 1 bits out.
53515351
</p>
53525352
<p>
5353-
The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).Int.bits){#endsyntax#} bits.
5354-
This is because {#syntax#}shift_amt >= @typeInfo(T).Int.bits{#endsyntax#} is undefined behavior.
5353+
The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).int.bits){#endsyntax#} bits.
5354+
This is because {#syntax#}shift_amt >= @typeInfo(T).int.bits{#endsyntax#} is undefined behavior.
53555355
</p>
53565356
{#see_also|@shlExact|@shlWithOverflow#}
53575357
{#header_close#}
@@ -5405,7 +5405,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
54055405
This size may contain padding bytes. If there were two consecutive T in memory, the padding would be the offset
54065406
in bytes between element at index 0 and the element at index 1. For {#link|integer|Integers#},
54075407
consider whether you want to use {#syntax#}@sizeOf(T){#endsyntax#} or
5408-
{#syntax#}@typeInfo(T).Int.bits{#endsyntax#}.
5408+
{#syntax#}@typeInfo(T).int.bits{#endsyntax#}.
54095409
</p>
54105410
<p>
54115411
This function measures the size at runtime. For types that are disallowed at runtime, such as

doc/langref/inline_prong_range.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
fn isFieldOptional(comptime T: type, field_index: usize) !bool {
2-
const fields = @typeInfo(T).Struct.fields;
2+
const fields = @typeInfo(T).@"struct".fields;
33
return switch (field_index) {
4-
inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
4+
inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .optional,
55
else => return error.IndexOutOfBounds,
66
};
77
}

doc/langref/poc_printValue_fn.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
const Writer = struct {
22
pub fn printValue(self: *Writer, value: anytype) !void {
33
switch (@typeInfo(@TypeOf(value))) {
4-
.Int => {
4+
.int => {
55
return self.writeInt(value);
66
},
7-
.Float => {
7+
.float => {
88
return self.writeFloat(value);
99
},
10-
.Pointer => {
10+
.pointer => {
1111
return self.write(value);
1212
},
1313
else => {

doc/langref/test_enums.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ const Small = enum {
9595
four,
9696
};
9797
test "std.meta.Tag" {
98-
try expect(@typeInfo(Small).Enum.tag_type == u2);
98+
try expect(@typeInfo(Small).@"enum".tag_type == u2);
9999
}
100100

101101
// @typeInfo tells us the field count and the fields names:
102102
test "@typeInfo" {
103-
try expect(@typeInfo(Small).Enum.fields.len == 4);
104-
try expect(mem.eql(u8, @typeInfo(Small).Enum.fields[1].name, "two"));
103+
try expect(@typeInfo(Small).@"enum".fields.len == 4);
104+
try expect(mem.eql(u8, @typeInfo(Small).@"enum".fields[1].name, "two"));
105105
}
106106

107107
// @tagName gives a [:0]const u8 representation of an enum value:

doc/langref/test_error_union.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ test "error union" {
1010
foo = error.SomeError;
1111

1212
// Use compile-time reflection to access the payload type of an error union:
13-
try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.payload == i32);
13+
try comptime expect(@typeInfo(@TypeOf(foo)).error_union.payload == i32);
1414

1515
// Use compile-time reflection to access the error set type of an error union:
16-
try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.error_set == anyerror);
16+
try comptime expect(@typeInfo(@TypeOf(foo)).error_union.error_set == anyerror);
1717
}
1818

1919
// test

doc/langref/test_fn_reflection.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ const math = std.math;
33
const testing = std.testing;
44

55
test "fn reflection" {
6-
try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.params[0].type.? == bool);
7-
try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir);
6+
try testing.expect(@typeInfo(@TypeOf(testing.expect)).@"fn".params[0].type.? == bool);
7+
try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).@"fn".return_type.? == testing.TmpDir);
88

9-
try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic);
9+
try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).@"fn".is_generic);
1010
}
1111

1212
// test

doc/langref/test_inline_else.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const AnySlice = union(enum) {
1717
};
1818

1919
fn withFor(any: AnySlice) usize {
20-
const Tag = @typeInfo(AnySlice).Union.tag_type.?;
21-
inline for (@typeInfo(Tag).Enum.fields) |field| {
20+
const Tag = @typeInfo(AnySlice).@"union".tag_type.?;
21+
inline for (@typeInfo(Tag).@"enum".fields) |field| {
2222
// With `inline for` the function gets generated as
2323
// a series of `if` statements relying on the optimizer
2424
// to convert it to a switch.

doc/langref/test_inline_switch.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const expect = std.testing.expect;
33
const expectError = std.testing.expectError;
44

55
fn isFieldOptional(comptime T: type, field_index: usize) !bool {
6-
const fields = @typeInfo(T).Struct.fields;
6+
const fields = @typeInfo(T).@"struct".fields;
77
return switch (field_index) {
88
// This prong is analyzed twice with `idx` being a
99
// comptime-known value each time.
10-
inline 0, 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
10+
inline 0, 1 => |idx| @typeInfo(fields[idx].type) == .optional,
1111
else => return error.IndexOutOfBounds,
1212
};
1313
}

doc/langref/test_optional_type.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test "optional type" {
88
foo = 1234;
99

1010
// Use compile-time reflection to access the child type of the optional:
11-
try comptime expect(@typeInfo(@TypeOf(foo)).Optional.child == i32);
11+
try comptime expect(@typeInfo(@TypeOf(foo)).optional.child == i32);
1212
}
1313

1414
// test

doc/langref/test_pointer_casting.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ test "pointer casting" {
1717

1818
test "pointer child type" {
1919
// pointer types have a `child` field which tells you the type they point to.
20-
try expect(@typeInfo(*u32).Pointer.child == u32);
20+
try expect(@typeInfo(*u32).pointer.child == u32);
2121
}
2222

2323
// test

doc/langref/test_variable_alignment.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ test "variable alignment" {
88
try expect(@TypeOf(&x) == *i32);
99
try expect(*i32 == *align(align_of_i32) i32);
1010
if (builtin.target.cpu.arch == .x86_64) {
11-
try expect(@typeInfo(*i32).Pointer.alignment == 4);
11+
try expect(@typeInfo(*i32).pointer.alignment == 4);
1212
}
1313
}
1414

doc/langref/test_variable_func_alignment.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const expect = @import("std").testing.expect;
33
var foo: u8 align(4) = 100;
44

55
test "global variable alignment" {
6-
try expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);
6+
try expect(@typeInfo(@TypeOf(&foo)).pointer.alignment == 4);
77
try expect(@TypeOf(&foo) == *align(4) u8);
88
const as_pointer_to_array: *align(4) [1]u8 = &foo;
99
const as_slice: []align(4) u8 = as_pointer_to_array;

doc/langref/test_variadic_function.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
55

66
test "variadic function" {
77
try testing.expect(printf("Hello, world!\n") == 14);
8-
try testing.expect(@typeInfo(@TypeOf(printf)).Fn.is_var_args);
8+
try testing.expect(@typeInfo(@TypeOf(printf)).@"fn".is_var_args);
99
}
1010

1111
// test

lib/compiler/aro/aro/Attribute.zig

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn requiredArgCount(attr: Tag) u32 {
6767
comptime {
6868
const fields = std.meta.fields(@field(attributes, @tagName(tag)));
6969
for (fields) |arg_field| {
70-
if (!mem.eql(u8, arg_field.name, "__name_tok") and @typeInfo(arg_field.type) != .Optional) needed += 1;
70+
if (!mem.eql(u8, arg_field.name, "__name_tok") and @typeInfo(arg_field.type) != .optional) needed += 1;
7171
}
7272
}
7373
return needed;
@@ -93,7 +93,7 @@ pub fn maxArgCount(attr: Tag) u32 {
9393

9494
fn UnwrapOptional(comptime T: type) type {
9595
return switch (@typeInfo(T)) {
96-
.Optional => |optional| optional.child,
96+
.optional => |optional| optional.child,
9797
else => T,
9898
};
9999
}
@@ -110,7 +110,7 @@ pub const Formatting = struct {
110110

111111
if (fields.len == 0) unreachable;
112112
const Unwrapped = UnwrapOptional(fields[0].type);
113-
if (@typeInfo(Unwrapped) != .Enum) unreachable;
113+
if (@typeInfo(Unwrapped) != .@"enum") unreachable;
114114

115115
return if (Unwrapped.opts.enum_kind == .identifier) "'" else "\"";
116116
},
@@ -127,9 +127,9 @@ pub const Formatting = struct {
127127

128128
if (fields.len == 0) unreachable;
129129
const Unwrapped = UnwrapOptional(fields[0].type);
130-
if (@typeInfo(Unwrapped) != .Enum) unreachable;
130+
if (@typeInfo(Unwrapped) != .@"enum") unreachable;
131131

132-
const enum_fields = @typeInfo(Unwrapped).Enum.fields;
132+
const enum_fields = @typeInfo(Unwrapped).@"enum".fields;
133133
@setEvalBranchQuota(3000);
134134
const quote = comptime quoteChar(@enumFromInt(@intFromEnum(tag)));
135135
comptime var values: []const u8 = quote ++ enum_fields[0].name ++ quote;
@@ -152,7 +152,7 @@ pub fn wantsIdentEnum(attr: Tag) bool {
152152

153153
if (fields.len == 0) return false;
154154
const Unwrapped = UnwrapOptional(fields[0].type);
155-
if (@typeInfo(Unwrapped) != .Enum) return false;
155+
if (@typeInfo(Unwrapped) != .@"enum") return false;
156156

157157
return Unwrapped.opts.enum_kind == .identifier;
158158
},
@@ -165,7 +165,7 @@ pub fn diagnoseIdent(attr: Tag, arguments: *Arguments, ident: []const u8) ?Diagn
165165
const fields = std.meta.fields(@field(attributes, @tagName(tag)));
166166
if (fields.len == 0) unreachable;
167167
const Unwrapped = UnwrapOptional(fields[0].type);
168-
if (@typeInfo(Unwrapped) != .Enum) unreachable;
168+
if (@typeInfo(Unwrapped) != .@"enum") unreachable;
169169
if (std.meta.stringToEnum(Unwrapped, normalize(ident))) |enum_val| {
170170
@field(@field(arguments, @tagName(tag)), fields[0].name) = enum_val;
171171
return null;
@@ -239,7 +239,7 @@ fn diagnoseField(
239239
const key = p.comp.interner.get(res.val.ref());
240240
switch (key) {
241241
.int => {
242-
if (@typeInfo(Wanted) == .Int) {
242+
if (@typeInfo(Wanted) == .int) {
243243
@field(@field(arguments, decl.name), field.name) = res.val.toInt(Wanted, p.comp) orelse return .{
244244
.tag = .attribute_int_out_of_range,
245245
.extra = .{ .str = try res.str(p) },
@@ -258,7 +258,7 @@ fn diagnoseField(
258258
}
259259
@field(@field(arguments, decl.name), field.name) = try p.removeNull(res.val);
260260
return null;
261-
} else if (@typeInfo(Wanted) == .Enum and @hasDecl(Wanted, "opts") and Wanted.opts.enum_kind == .string) {
261+
} else if (@typeInfo(Wanted) == .@"enum" and @hasDecl(Wanted, "opts") and Wanted.opts.enum_kind == .string) {
262262
const str = bytes[0 .. bytes.len - 1];
263263
if (std.meta.stringToEnum(Wanted, str)) |enum_val| {
264264
@field(@field(arguments, decl.name), field.name) = enum_val;
@@ -293,7 +293,7 @@ fn invalidArgMsg(comptime Expected: type, actual: ArgumentType) Diagnostics.Mess
293293
Alignment => .alignment,
294294
CallingConvention => .identifier,
295295
else => switch (@typeInfo(Expected)) {
296-
.Enum => if (Expected.opts.enum_kind == .string) .string else .identifier,
296+
.@"enum" => if (Expected.opts.enum_kind == .string) .string else .identifier,
297297
else => unreachable,
298298
},
299299
}, .actual = actual } },
@@ -303,7 +303,7 @@ fn invalidArgMsg(comptime Expected: type, actual: ArgumentType) Diagnostics.Mess
303303
pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, node: Tree.Node, p: *Parser) !?Diagnostics.Message {
304304
switch (attr) {
305305
inline else => |tag| {
306-
const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)];
306+
const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
307307
const max_arg_count = comptime maxArgCount(tag);
308308
if (arg_idx >= max_arg_count) return Diagnostics.Message{
309309
.tag = .attribute_too_many_args,
@@ -641,7 +641,7 @@ const attributes = struct {
641641
pub const Tag = std.meta.DeclEnum(attributes);
642642

643643
pub const Arguments = blk: {
644-
const decls = @typeInfo(attributes).Struct.decls;
644+
const decls = @typeInfo(attributes).@"struct".decls;
645645
var union_fields: [decls.len]ZigType.UnionField = undefined;
646646
for (decls, &union_fields) |decl, *field| {
647647
field.* = .{
@@ -652,7 +652,7 @@ pub const Arguments = blk: {
652652
}
653653

654654
break :blk @Type(.{
655-
.Union = .{
655+
.@"union" = .{
656656
.layout = .auto,
657657
.tag_type = null,
658658
.fields = &union_fields,
@@ -662,7 +662,7 @@ pub const Arguments = blk: {
662662
};
663663

664664
pub fn ArgumentsForTag(comptime tag: Tag) type {
665-
const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)];
665+
const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
666666
return @field(attributes, decl.name);
667667
}
668668

lib/compiler/aro/aro/Compilation.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub const Environment = struct {
6161
var env: Environment = .{};
6262
errdefer env.deinit(allocator);
6363

64-
inline for (@typeInfo(@TypeOf(env)).Struct.fields) |field| {
64+
inline for (@typeInfo(@TypeOf(env)).@"struct".fields) |field| {
6565
std.debug.assert(@field(env, field.name) == null);
6666

6767
var env_var_buf: [field.name.len]u8 = undefined;
@@ -78,7 +78,7 @@ pub const Environment = struct {
7878

7979
/// Use this only if environment slices were allocated with `allocator` (such as via `loadAll`)
8080
pub fn deinit(self: *Environment, allocator: std.mem.Allocator) void {
81-
inline for (@typeInfo(@TypeOf(self.*)).Struct.fields) |field| {
81+
inline for (@typeInfo(@TypeOf(self.*)).@"struct".fields) |field| {
8282
if (@field(self, field.name)) |slice| {
8383
allocator.free(slice);
8484
}

lib/compiler/aro/aro/Tree.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ fn dumpAttribute(tree: *const Tree, attr: Attribute, writer: anytype) !void {
707707
switch (attr.tag) {
708708
inline else => |tag| {
709709
const args = @field(attr.args, @tagName(tag));
710-
const fields = @typeInfo(@TypeOf(args)).Struct.fields;
710+
const fields = @typeInfo(@TypeOf(args)).@"struct".fields;
711711
if (fields.len == 0) {
712712
try writer.writeByte('\n');
713713
return;
@@ -724,7 +724,7 @@ fn dumpAttribute(tree: *const Tree, attr: Attribute, writer: anytype) !void {
724724
Interner.Ref => try writer.print("\"{s}\"", .{tree.interner.get(@field(args, f.name)).bytes}),
725725
?Interner.Ref => try writer.print("\"{?s}\"", .{if (@field(args, f.name)) |str| tree.interner.get(str).bytes else null}),
726726
else => switch (@typeInfo(f.type)) {
727-
.Enum => try writer.writeAll(@tagName(@field(args, f.name))),
727+
.@"enum" => try writer.writeAll(@tagName(@field(args, f.name))),
728728
else => try writer.print("{any}", .{@field(args, f.name)}),
729729
},
730730
}

lib/compiler/aro/aro/Value.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn intern(comp: *Compilation, k: Interner.Key) !Value {
2424

2525
pub fn int(i: anytype, comp: *Compilation) !Value {
2626
const info = @typeInfo(@TypeOf(i));
27-
if (info == .ComptimeInt or info.Int.signedness == .unsigned) {
27+
if (info == .comptime_int or info.int.signedness == .unsigned) {
2828
return intern(comp, .{ .int = .{ .u64 = i } });
2929
} else {
3030
return intern(comp, .{ .int = .{ .i64 = i } });

0 commit comments

Comments
 (0)