aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-06-24 16:58:19 -0700
committerGitHub <noreply@github.com>2023-06-24 16:58:19 -0700
commit146b79af153bbd5dafda0ba12a040385c7fc58f8 (patch)
tree67e3db8b444d65c667e314770fc983a7fc8ba293 /src/main.zig
parent13853bef0df3c90633021850cc6d6abaeea03282 (diff)
parent21ac0beb436f49fe49c6982a872f2dc48e4bea5e (diff)
downloadzig-146b79af153bbd5dafda0ba12a040385c7fc58f8.tar.gz
zig-146b79af153bbd5dafda0ba12a040385c7fc58f8.zip
Merge pull request #16163 from mlugg/feat/builtins-infer-dest-ty
Infer destination type of cast builtins using result type
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main.zig b/src/main.zig
index 22d2d075d1..02e1ef6f00 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -3523,7 +3523,7 @@ fn progressThread(progress: *std.Progress, server: *const Server, reset: *std.Th
server.serveMessage(.{
.tag = .progress,
- .bytes_len = @intCast(u32, progress_string.len),
+ .bytes_len = @as(u32, @intCast(progress_string.len)),
}, &.{
progress_string,
}) catch |err| {
@@ -5020,8 +5020,8 @@ pub fn clangMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}!
// Convert the args to the null-terminated format Clang expects.
const argv = try argsCopyZ(arena, args);
- const exit_code = ZigClang_main(@intCast(c_int, argv.len), argv.ptr);
- return @bitCast(u8, @truncate(i8, exit_code));
+ const exit_code = ZigClang_main(@as(c_int, @intCast(argv.len)), argv.ptr);
+ return @as(u8, @bitCast(@as(i8, @truncate(exit_code))));
}
pub fn llvmArMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}!u8 {
@@ -5035,8 +5035,8 @@ pub fn llvmArMain(alloc: Allocator, args: []const []const u8) error{OutOfMemory}
// Convert the args to the format llvm-ar expects.
// We intentionally shave off the zig binary at args[0].
const argv = try argsCopyZ(arena, args[1..]);
- const exit_code = ZigLlvmAr_main(@intCast(c_int, argv.len), argv.ptr);
- return @bitCast(u8, @truncate(i8, exit_code));
+ const exit_code = ZigLlvmAr_main(@as(c_int, @intCast(argv.len)), argv.ptr);
+ return @as(u8, @bitCast(@as(i8, @truncate(exit_code))));
}
/// The first argument determines which backend is invoked. The options are:
@@ -5072,7 +5072,7 @@ pub fn lldMain(
// "If an error occurs, false will be returned."
const ok = rc: {
const llvm = @import("codegen/llvm/bindings.zig");
- const argc = @intCast(c_int, argv.len);
+ const argc = @as(c_int, @intCast(argv.len));
if (mem.eql(u8, args[1], "ld.lld")) {
break :rc llvm.LinkELF(argc, argv.ptr, can_exit_early, false);
} else if (mem.eql(u8, args[1], "lld-link")) {
@@ -5507,7 +5507,7 @@ pub fn cmdAstCheck(
if (stat.size > max_src_size)
return error.FileTooBig;
- const source = try arena.allocSentinel(u8, @intCast(usize, stat.size), 0);
+ const source = try arena.allocSentinel(u8, @as(usize, @intCast(stat.size)), 0);
const amt = try f.readAll(source);
if (amt != stat.size)
return error.UnexpectedEndOfFile;
@@ -5703,7 +5703,7 @@ pub fn cmdChangelist(
file.pkg = try Package.create(gpa, null, file.sub_file_path);
defer file.pkg.destroy(gpa);
- const source = try arena.allocSentinel(u8, @intCast(usize, stat.size), 0);
+ const source = try arena.allocSentinel(u8, @as(usize, @intCast(stat.size)), 0);
const amt = try f.readAll(source);
if (amt != stat.size)
return error.UnexpectedEndOfFile;
@@ -5739,7 +5739,7 @@ pub fn cmdChangelist(
if (new_stat.size > max_src_size)
return error.FileTooBig;
- const new_source = try arena.allocSentinel(u8, @intCast(usize, new_stat.size), 0);
+ const new_source = try arena.allocSentinel(u8, @as(usize, @intCast(new_stat.size)), 0);
const new_amt = try new_f.readAll(new_source);
if (new_amt != new_stat.size)
return error.UnexpectedEndOfFile;