diff options
| author | Vexu <15308111+Vexu@users.noreply.github.com> | 2019-11-23 19:36:26 +0200 |
|---|---|---|
| committer | Vexu <15308111+Vexu@users.noreply.github.com> | 2019-11-23 19:36:26 +0200 |
| commit | 133579d7c05a92e33bd8a4cfaf5c460f48150de7 (patch) | |
| tree | 32a7dec3c31da1d84baa6bfedbf0b19abf854090 | |
| parent | 03cc81665bb28eb35c8c6d4be17b5a56fa66261f (diff) | |
| download | zig-133579d7c05a92e33bd8a4cfaf5c460f48150de7.tar.gz zig-133579d7c05a92e33bd8a4cfaf5c460f48150de7.zip | |
fix casts
| -rw-r--r-- | src-self-hosted/compilation.zig | 9 | ||||
| -rw-r--r-- | src-self-hosted/libc_installation.zig | 4 | ||||
| -rw-r--r-- | src-self-hosted/main.zig | 2 | ||||
| -rw-r--r-- | src-self-hosted/type.zig | 8 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src-self-hosted/compilation.zig b/src-self-hosted/compilation.zig index 52d02ff4bb..847596c5d5 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 0cd43c8ba9..7001cf6e3f 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 87f7eca051..1afc0e1919 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 cea461d608..f3fb71b536 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))), |
