diff --git a/src/Module.zig b/src/Module.zig index 6f0fd7bfb0..0ae6158758 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1071,7 +1071,7 @@ pub const Scope = struct { if (stat.size > std.math.maxInt(u32)) return error.FileTooBig; - const source = try gpa.allocSentinel(u8, stat.size, 0); + const source = try gpa.allocSentinel(u8, @intCast(usize, stat.size), 0); defer if (!file.source_loaded) gpa.free(source); const amt = try f.readAll(source); if (amt != stat.size) @@ -2441,7 +2441,7 @@ pub fn astGenFile(mod: *Module, file: *Scope.File, prog_node: *std.Progress.Node if (stat.size > std.math.maxInt(u32)) return error.FileTooBig; - const source = try gpa.allocSentinel(u8, stat.size, 0); + const source = try gpa.allocSentinel(u8, @intCast(usize, stat.size), 0); defer if (!file.source_loaded) gpa.free(source); const amt = try source_file.readAll(source); if (amt != stat.size) diff --git a/src/Sema.zig b/src/Sema.zig index bf0158b37a..64b0988f07 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -2483,7 +2483,7 @@ fn zirIntToError(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerEr const payload = try sema.arena.create(Value.Payload.Error); payload.* = .{ .base = .{ .tag = .@"error" }, - .data = .{ .name = sema.mod.error_name_list.items[int] }, + .data = .{ .name = sema.mod.error_name_list.items[@intCast(usize, int)] }, }; return sema.mod.constInst(sema.arena, src, .{ .ty = Type.initTag(.anyerror), diff --git a/src/main.zig b/src/main.zig index 4b8f30b109..455f19cccc 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3642,7 +3642,7 @@ pub fn cmdAstCheck( if (stat.size > max_src_size) return error.FileTooBig; - const source = try arena.allocSentinel(u8, stat.size, 0); + const source = try arena.allocSentinel(u8, @intCast(usize, stat.size), 0); const amt = try f.readAll(source); if (amt != stat.size) return error.UnexpectedEndOfFile; @@ -3778,7 +3778,7 @@ pub fn cmdChangelist( .root_decl = null, }; - const source = try arena.allocSentinel(u8, stat.size, 0); + const source = try arena.allocSentinel(u8, @intCast(usize, stat.size), 0); const amt = try f.readAll(source); if (amt != stat.size) return error.UnexpectedEndOfFile; @@ -3818,7 +3818,7 @@ pub fn cmdChangelist( if (new_stat.size > max_src_size) return error.FileTooBig; - const new_source = try arena.allocSentinel(u8, new_stat.size, 0); + const new_source = try arena.allocSentinel(u8, @intCast(usize, new_stat.size), 0); const new_amt = try new_f.readAll(new_source); if (new_amt != new_stat.size) return error.UnexpectedEndOfFile; diff --git a/src/type.zig b/src/type.zig index e54413ffb9..14646450aa 100644 --- a/src/type.zig +++ b/src/type.zig @@ -2641,7 +2641,7 @@ pub const Type = extern union { }; const end_val = Value.initPayload(&end_payload.base); if (int_val.compare(.gte, end_val)) return null; - return int_val.toUnsignedInt(); + return @intCast(usize, int_val.toUnsignedInt()); } }; switch (ty.tag()) {