diff options
| author | Ali Chraghi <chraghiali1@gmail.com> | 2022-05-22 19:36:59 +0430 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-05-27 16:43:33 -0400 |
| commit | 0e6285c8fc31ff866df96847fe34e660da38b4a9 (patch) | |
| tree | 5d5830d5b3ce6c13041aacb7e073763551cb4852 /src/arch/x86_64/CodeGen.zig | |
| parent | ddd5b57045d38b7d1f7d5a4120302797433233cd (diff) | |
| download | zig-0e6285c8fc31ff866df96847fe34e660da38b4a9.tar.gz zig-0e6285c8fc31ff866df96847fe34e660da38b4a9.zip | |
math: make `cast` return optional instead of an error
Diffstat (limited to 'src/arch/x86_64/CodeGen.zig')
| -rw-r--r-- | src/arch/x86_64/CodeGen.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig index 8adad94e24..33734eda30 100644 --- a/src/arch/x86_64/CodeGen.zig +++ b/src/arch/x86_64/CodeGen.zig @@ -854,7 +854,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { return self.allocMem(inst, @sizeOf(usize), @alignOf(usize)); } - const abi_size = math.cast(u32, elem_ty.abiSize(self.target.*)) catch { + const abi_size = math.cast(u32, elem_ty.abiSize(self.target.*)) orelse { const mod = self.bin_file.options.module.?; return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); }; @@ -865,7 +865,7 @@ fn allocMemPtr(self: *Self, inst: Air.Inst.Index) !u32 { fn allocRegOrMem(self: *Self, inst: Air.Inst.Index, reg_ok: bool) !MCValue { const elem_ty = self.air.typeOfIndex(inst); - const abi_size = math.cast(u32, elem_ty.abiSize(self.target.*)) catch { + const abi_size = math.cast(u32, elem_ty.abiSize(self.target.*)) orelse { const mod = self.bin_file.options.module.?; return self.fail("type '{}' too big to fit into stack frame", .{elem_ty.fmt(mod)}); }; |
