diff --git a/crates/compiler/builtins/bitcode/src/dec.zig b/crates/compiler/builtins/bitcode/src/dec.zig index 2507b81f154..028f57a916a 100644 --- a/crates/compiler/builtins/bitcode/src/dec.zig +++ b/crates/compiler/builtins/bitcode/src/dec.zig @@ -252,7 +252,6 @@ pub const RocDec = extern struct { if (answer.has_overflowed) { roc_panic("Decimal addition overflowed!", 0); - unreachable; } else { return answer.value; } @@ -283,7 +282,6 @@ pub const RocDec = extern struct { if (answer.has_overflowed) { roc_panic("Decimal subtraction overflowed!", 0); - unreachable; } else { return answer.value; } @@ -347,7 +345,6 @@ pub const RocDec = extern struct { if (answer.has_overflowed) { roc_panic("Decimal multiplication overflowed!", 0); - unreachable; } else { return answer.value; } @@ -398,7 +395,6 @@ pub const RocDec = extern struct { return self; } else { roc_panic("Decimal division overflow in numerator!", 0); - unreachable; } }; const numerator_u128 = @as(u128, @intCast(numerator_abs_i128)); @@ -412,7 +408,6 @@ pub const RocDec = extern struct { return other; } else { roc_panic("Decimal division overflow in denominator!", 0); - unreachable; } }; const denominator_u128 = @as(u128, @intCast(denominator_abs_i128)); @@ -634,7 +629,7 @@ fn mul_and_decimalize(a: u128, b: u128) i128 { const d = answer[0]; if (overflowed == 1) { - roc_panic("Decimal multiplication overflow!", 0); + roc_panic("Decimal multiplication overflow22!", 0); } // Final 512bit value is d, c, b, a @@ -1211,7 +1206,6 @@ pub fn fromF64C(arg: f64) callconv(.C) i128 { return dec.num; } else { roc_panic("Decimal conversion from f64!", 0); - unreachable; } } @@ -1221,7 +1215,6 @@ pub fn fromF32C(arg_f32: f32) callconv(.C) i128 { return dec.num; } else { roc_panic("Decimal conversion from f32!", 0); - unreachable; } } @@ -1237,7 +1230,6 @@ pub fn exportFromInt(comptime T: type, comptime name: []const u8) void { const answer = @mulWithOverflow(this, RocDec.one_point_zero_i128); if (answer[1] == 1) { roc_panic("Decimal conversion from integer!", 0); - unreachable; } else { return answer[0]; } @@ -1265,14 +1257,12 @@ pub fn neqC(arg1: RocDec, arg2: RocDec) callconv(.C) bool { pub fn negateC(arg: RocDec) callconv(.C) i128 { return if (@call(.always_inline, RocDec.negate, .{arg})) |dec| dec.num else { roc_panic("Decimal negation overflow!", 0); - unreachable; }; } pub fn absC(arg: RocDec) callconv(.C) i128 { const result = @call(.always_inline, RocDec.abs, .{arg}) catch { roc_panic("Decimal absolute value overflow!", 0); - unreachable; }; return result.num; } diff --git a/crates/compiler/builtins/bitcode/src/num.zig b/crates/compiler/builtins/bitcode/src/num.zig index 614cf6ea0ef..845cf21aa37 100644 --- a/crates/compiler/builtins/bitcode/src/num.zig +++ b/crates/compiler/builtins/bitcode/src/num.zig @@ -235,7 +235,6 @@ pub fn exportDivCeil(comptime T: type, comptime name: []const u8) void { fn func(a: T, b: T) callconv(.C) T { return math.divCeil(T, a, b) catch { roc_panic("integer division by 0!", 0); - unreachable; }; } }.func; @@ -383,7 +382,6 @@ pub fn exportAddOrPanic(comptime T: type, comptime name: []const u8) void { const result = addWithOverflow(T, self, other); if (result.has_overflowed) { roc_panic("integer addition overflowed!", 0); - unreachable; } else { return result.value; } @@ -441,7 +439,6 @@ pub fn exportSubOrPanic(comptime T: type, comptime name: []const u8) void { const result = subWithOverflow(T, self, other); if (result.has_overflowed) { roc_panic("integer subtraction overflowed!", 0); - unreachable; } else { return result.value; } @@ -626,7 +623,6 @@ pub fn exportMulOrPanic(comptime T: type, comptime W: type, comptime name: []con const result = @call(.always_inline, mulWithOverflow, .{ T, W, self, other }); if (result.has_overflowed) { roc_panic("integer multiplication overflowed!", 0); - unreachable; } else { return result.value; } diff --git a/crates/compiler/builtins/bitcode/src/panic.zig b/crates/compiler/builtins/bitcode/src/panic.zig index 76ecd69e123..13224a67df1 100644 --- a/crates/compiler/builtins/bitcode/src/panic.zig +++ b/crates/compiler/builtins/bitcode/src/panic.zig @@ -2,14 +2,14 @@ const std = @import("std"); const RocStr = @import("str.zig").RocStr; // Signals to the host that the program has panicked -extern fn roc_panic(msg: *const RocStr, tag_id: u32) callconv(.C) void; +extern fn roc_panic(msg: *const RocStr, tag_id: u32) callconv(.C) noreturn; -pub fn panic_help(msg: []const u8, tag_id: u32) void { +pub fn panic_help(msg: []const u8, tag_id: u32) noreturn { var str = RocStr.init(msg.ptr, msg.len); roc_panic(&str, tag_id); } // must export this explicitly because right now it is not used from zig code -pub fn panic(msg: *const RocStr, alignment: u32) callconv(.C) void { +pub fn panic(msg: *const RocStr, alignment: u32) callconv(.C) noreturn { return roc_panic(msg, alignment); }