aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-08-28 10:49:31 -0700
committerGitHub <noreply@github.com>2024-08-28 10:49:31 -0700
commit31fef6f1103ea64a899729adea13b0ab9b66cb46 (patch)
tree31c13b06483af84cd0977be8de00d3539e3e3c4d /lib/std/Build
parent9a12905a2da045b0948f612583b526bca3a1b2f0 (diff)
parentaaa7e739831f39151a37c7beb08660f0fb6ae0ed (diff)
downloadzig-31fef6f1103ea64a899729adea13b0ab9b66cb46.tar.gz
zig-31fef6f1103ea64a899729adea13b0ab9b66cb46.zip
Merge pull request #21225 from mlugg/std-builtin-type
std: update `std.builtin.Type` fields to follow naming conventions
Diffstat (limited to 'lib/std/Build')
-rw-r--r--lib/std/Build/Cache.zig6
-rw-r--r--lib/std/Build/Cache/Path.zig4
-rw-r--r--lib/std/Build/Step/ConfigHeader.zig22
-rw-r--r--lib/std/Build/Step/Options.zig34
-rw-r--r--lib/std/Build/Step/Run.zig2
5 files changed, 34 insertions, 34 deletions
diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig
index 1eabdd54e6..93908807eb 100644
--- a/lib/std/Build/Cache.zig
+++ b/lib/std/Build/Cache.zig
@@ -222,7 +222,7 @@ pub const HashHelper = struct {
.hexstring => |hex_string| hh.addBytes(hex_string.toSlice()),
},
else => switch (@typeInfo(@TypeOf(x))) {
- .Bool, .Int, .Enum, .Array => hh.addBytes(mem.asBytes(&x)),
+ .bool, .int, .@"enum", .array => hh.addBytes(mem.asBytes(&x)),
else => @compileError("unable to hash type " ++ @typeName(@TypeOf(x))),
},
}
@@ -1014,7 +1014,7 @@ pub const Manifest = struct {
}
pub fn populateFileSystemInputs(man: *Manifest, buf: *std.ArrayListUnmanaged(u8)) Allocator.Error!void {
- assert(@typeInfo(std.zig.Server.Message.PathPrefix).Enum.fields.len == man.cache.prefixes_len);
+ assert(@typeInfo(std.zig.Server.Message.PathPrefix).@"enum".fields.len == man.cache.prefixes_len);
buf.clearRetainingCapacity();
const gpa = man.cache.gpa;
const files = man.files.keys();
@@ -1032,7 +1032,7 @@ pub const Manifest = struct {
pub fn populateOtherManifest(man: *Manifest, other: *Manifest, prefix_map: [4]u8) Allocator.Error!void {
const gpa = other.cache.gpa;
- assert(@typeInfo(std.zig.Server.Message.PathPrefix).Enum.fields.len == man.cache.prefixes_len);
+ assert(@typeInfo(std.zig.Server.Message.PathPrefix).@"enum".fields.len == man.cache.prefixes_len);
assert(man.cache.prefixes_len == 4);
for (man.files.keys()) |file| {
const prefixed_path: PrefixedPath = .{
diff --git a/lib/std/Build/Cache/Path.zig b/lib/std/Build/Cache/Path.zig
index 65c6f6a9bc..ee0666b70a 100644
--- a/lib/std/Build/Cache/Path.zig
+++ b/lib/std/Build/Cache/Path.zig
@@ -189,8 +189,8 @@ pub const TableAdapter = struct {
pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
_ = self;
const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
- .Pointer => @intFromPtr(a.root_dir.handle.fd),
- .Int => @as(u32, @bitCast(a.root_dir.handle.fd)),
+ .pointer => @intFromPtr(a.root_dir.handle.fd),
+ .int => @as(u32, @bitCast(a.root_dir.handle.fd)),
else => @compileError("unimplemented hash function"),
};
return @truncate(Hash.hash(seed, a.sub_path));
diff --git a/lib/std/Build/Step/ConfigHeader.zig b/lib/std/Build/Step/ConfigHeader.zig
index 512460a532..895f50f5d0 100644
--- a/lib/std/Build/Step/ConfigHeader.zig
+++ b/lib/std/Build/Step/ConfigHeader.zig
@@ -109,47 +109,47 @@ pub fn getOutput(config_header: *ConfigHeader) std.Build.LazyPath {
}
fn addValuesInner(config_header: *ConfigHeader, values: anytype) !void {
- inline for (@typeInfo(@TypeOf(values)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(values)).@"struct".fields) |field| {
try putValue(config_header, field.name, field.type, @field(values, field.name));
}
}
fn putValue(config_header: *ConfigHeader, field_name: []const u8, comptime T: type, v: T) !void {
switch (@typeInfo(T)) {
- .Null => {
+ .null => {
try config_header.values.put(field_name, .undef);
},
- .Void => {
+ .void => {
try config_header.values.put(field_name, .defined);
},
- .Bool => {
+ .bool => {
try config_header.values.put(field_name, .{ .boolean = v });
},
- .Int => {
+ .int => {
try config_header.values.put(field_name, .{ .int = v });
},
- .ComptimeInt => {
+ .comptime_int => {
try config_header.values.put(field_name, .{ .int = v });
},
- .EnumLiteral => {
+ .enum_literal => {
try config_header.values.put(field_name, .{ .ident = @tagName(v) });
},
- .Optional => {
+ .optional => {
if (v) |x| {
return putValue(config_header, field_name, @TypeOf(x), x);
} else {
try config_header.values.put(field_name, .undef);
}
},
- .Pointer => |ptr| {
+ .pointer => |ptr| {
switch (@typeInfo(ptr.child)) {
- .Array => |array| {
+ .array => |array| {
if (ptr.size == .One and array.child == u8) {
try config_header.values.put(field_name, .{ .string = v });
return;
}
},
- .Int => {
+ .int => {
if (ptr.size == .Slice and ptr.child == u8) {
try config_header.values.put(field_name, .{ .string = v });
return;
diff --git a/lib/std/Build/Step/Options.zig b/lib/std/Build/Step/Options.zig
index 6131912b1b..41739dba47 100644
--- a/lib/std/Build/Step/Options.zig
+++ b/lib/std/Build/Step/Options.zig
@@ -151,7 +151,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
switch (@typeInfo(T)) {
- .Array => {
+ .array => {
if (name) |some| {
try out.print("pub const {}: {s} = ", .{ std.zig.fmtId(some), @typeName(T) });
}
@@ -171,7 +171,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Pointer => |p| {
+ .pointer => |p| {
if (p.size != .Slice) {
@compileError("Non-slice pointers are not yet supported in build options");
}
@@ -195,7 +195,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Optional => {
+ .optional => {
if (name) |some| {
try out.print("pub const {}: {s} = ", .{ std.zig.fmtId(some), @typeName(T) });
}
@@ -216,12 +216,12 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Void,
- .Bool,
- .Int,
- .ComptimeInt,
- .Float,
- .Null,
+ .void,
+ .bool,
+ .int,
+ .comptime_int,
+ .float,
+ .null,
=> {
if (name) |some| {
try out.print("pub const {}: {s} = {any};\n", .{ std.zig.fmtId(some), @typeName(T), value });
@@ -230,7 +230,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Enum => |info| {
+ .@"enum" => |info| {
try printEnum(options, out, T, info, indent);
if (name) |some| {
@@ -242,7 +242,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Struct => |info| {
+ .@"struct" => |info| {
try printStruct(options, out, T, info, indent);
if (name) |some| {
@@ -260,10 +260,10 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
fn printUserDefinedType(options: *Options, out: anytype, comptime T: type, indent: u8) !void {
switch (@typeInfo(T)) {
- .Enum => |info| {
+ .@"enum" => |info| {
return try printEnum(options, out, T, info, indent);
},
- .Struct => |info| {
+ .@"struct" => |info| {
return try printStruct(options, out, T, info, indent);
},
else => {},
@@ -323,8 +323,8 @@ fn printStruct(options: *Options, out: anytype, comptime T: type, comptime val:
try out.writeAll(" = ");
switch (@typeInfo(@TypeOf(default_value))) {
- .Enum => try out.print(".{s},\n", .{@tagName(default_value)}),
- .Struct => |info| {
+ .@"enum" => try out.print(".{s},\n", .{@tagName(default_value)}),
+ .@"struct" => |info| {
try printStructValue(options, out, info, default_value, indent + 4);
},
else => try printType(options, out, @TypeOf(default_value), default_value, indent, null),
@@ -359,8 +359,8 @@ fn printStructValue(options: *Options, out: anytype, comptime struct_val: std.bu
const field_name = @field(val, field.name);
switch (@typeInfo(@TypeOf(field_name))) {
- .Enum => try out.print(".{s},\n", .{@tagName(field_name)}),
- .Struct => |struct_info| {
+ .@"enum" => try out.print(".{s},\n", .{@tagName(field_name)}),
+ .@"struct" => |struct_info| {
try printStructValue(options, out, struct_info, field_name, indent + 4);
},
else => try printType(options, out, @TypeOf(field_name), field_name, indent, null),
diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig
index 0c011e25ed..e37b97ddb3 100644
--- a/lib/std/Build/Step/Run.zig
+++ b/lib/std/Build/Step/Run.zig
@@ -614,7 +614,7 @@ fn checksContainStderr(checks: []const StdIo.Check) bool {
const IndexedOutput = struct {
index: usize,
- tag: @typeInfo(Arg).Union.tag_type.?,
+ tag: @typeInfo(Arg).@"union".tag_type.?,
output: *Output,
};
fn make(step: *Step, options: Step.MakeOptions) !void {