diff --git a/src-self-hosted/compilation.zig b/src-self-hosted/compilation.zig index 52d02ff4bb8733b0c511fd5493da8fb79272a47c..847596c5d56ae13a024c255ec85653c79dc5f232 100644 --- a/src-self-hosted/compilation.zig +++ b/src-self-hosted/compilation.zig @@ -548,10 +548,11 @@ pub const Compilation = struct { comp.deinit_group.wait(); - if (comp.tmp_dir.getOrNull()) |tmp_dir_result| if (tmp_dir_result.*) |tmp_dir| { - // TODO evented I/O? - std.fs.deleteTree(tmp_dir) catch {}; - } else |_| {}; + if (comp.tmp_dir.getOrNull()) |tmp_dir_result| + if (tmp_dir_result.*) |tmp_dir| { + // TODO evented I/O? + std.fs.deleteTree(tmp_dir) catch {}; + } else |_| {}; } /// it does ref the result because it could be an arbitrary integer size diff --git a/src-self-hosted/libc_installation.zig b/src-self-hosted/libc_installation.zig index 0cd43c8ba9d235dc842aa8cb2228eeb35bb369b0..7001cf6e3f4b36f7bf608539fdabf6751b87cba9 100644 --- a/src-self-hosted/libc_installation.zig +++ b/src-self-hosted/libc_installation.zig @@ -138,7 +138,7 @@ pub const LibCInstallation = struct { self.static_lib_dir orelse "", self.msvc_lib_dir orelse "", self.kernel32_lib_dir orelse "", - self.dynamic_linker_path orelse util.getDynamicLinkerPath(Target(Target.Native)), + self.dynamic_linker_path orelse util.getDynamicLinkerPath(Target{ .Native = {} }), ); } @@ -382,7 +382,7 @@ pub const LibCInstallation = struct { fn initEmpty(self: *LibCInstallation) void { self.* = LibCInstallation{ - .include_dir = ([*]const u8)(undefined)[0..0], + .include_dir = @as([*]const u8, undefined)[0..0], .lib_dir = null, .static_lib_dir = null, .msvc_lib_dir = null, diff --git a/src-self-hosted/main.zig b/src-self-hosted/main.zig index 87f7eca051db57bc29ab0a311e14689a8a026a14..1afc0e1919f3cecb5252175ed22104b9b0c88074 100644 --- a/src-self-hosted/main.zig +++ b/src-self-hosted/main.zig @@ -631,7 +631,7 @@ fn cmdFmt(allocator: *Allocator, args: []const []const u8) !void { } if (flags.present("check")) { const anything_changed = try std.zig.render(allocator, io.null_out_stream, tree); - const code = if (anything_changed) u8(1) else u8(0); + const code: u8 = if (anything_changed) 1 else 0; process.exit(code); } diff --git a/src-self-hosted/type.zig b/src-self-hosted/type.zig index cea461d608b13f096f80d8599508b56164b924ff..f3fb71b536023def55cc82b7052d8014bc02cce5 100644 --- a/src-self-hosted/type.zig +++ b/src-self-hosted/type.zig @@ -294,7 +294,7 @@ pub const Type = struct { if (self.alignment) |self_align| { if (self_align != other.alignment.?) return false; } - if (@TagType(Data)(self.data) != @TagType(Data)(other.data)) return false; + if (@as(@TagType(Data), self.data) != @as(@TagType(Data), other.data)) return false; switch (self.data) { .Generic => |*self_generic| { const other_generic = &other.data.Generic; @@ -665,7 +665,7 @@ pub const Type = struct { self.mut != other.mut or self.vol != other.vol or self.size != other.size or - @TagType(Align)(self.alignment) != @TagType(Align)(other.alignment)) + @as(@TagType(Align), self.alignment) != @as(@TagType(Align), other.alignment)) { return false; } @@ -1058,7 +1058,7 @@ fn hashAny(x: var, comptime seed: u64) u32 { comptime var rng = comptime std.rand.DefaultPrng.init(seed); const unsigned_x = @bitCast(@IntType(false, info.bits), x); if (info.bits <= 32) { - return u32(unsigned_x) *% comptime rng.random.scalar(u32); + return @as(u32, unsigned_x) *% comptime rng.random.scalar(u32); } else { return @truncate(u32, unsigned_x *% comptime rng.random.scalar(@typeOf(unsigned_x))); } @@ -1081,7 +1081,7 @@ fn hashAny(x: var, comptime seed: u64) u32 { if (x) |non_opt| { return hashAny(non_opt, seed); } else { - return hashAny(u32(1), seed); + return hashAny(@as(u32, 1), seed); } }, else => @compileError("implement hash function for " ++ @typeName(@typeOf(x))),