diff options
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/builtin.zig | 20 | ||||
| -rw-r--r-- | lib/std/debug.zig | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 4edcebad53..704d89dace 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -833,6 +833,10 @@ pub const PanicCause = union(enum) { pub fn panicSentinelMismatch(expected: anytype, found: @TypeOf(expected)) noreturn { @branchHint(.cold); + if (builtin.zig_backend == .stage2_riscv64) { + // https://github.com/ziglang/zig/issues/21519 + @trap(); + } switch (@typeInfo(@TypeOf(expected))) { .int => |int| switch (int.signedness) { .unsigned => if (int.bits <= @bitSizeOf(usize)) panic(.{ .sentinel_mismatch_usize = .{ @@ -864,11 +868,19 @@ pub fn panicSentinelMismatch(expected: anytype, found: @TypeOf(expected)) noretu pub fn panicUnwrapError(ert: ?*StackTrace, err: anyerror) noreturn { @branchHint(.cold); + if (builtin.zig_backend == .stage2_riscv64) { + // https://github.com/ziglang/zig/issues/21519 + @trap(); + } panic(.{ .unwrap_error = err }, ert, @returnAddress()); } pub fn panicOutOfBounds(index: usize, len: usize) noreturn { @branchHint(.cold); + if (builtin.zig_backend == .stage2_riscv64) { + // https://github.com/ziglang/zig/issues/21519 + @trap(); + } panic(.{ .index_out_of_bounds = .{ .index = index, .len = len, @@ -877,6 +889,10 @@ pub fn panicOutOfBounds(index: usize, len: usize) noreturn { pub fn panicStartGreaterThanEnd(start: usize, end: usize) noreturn { @branchHint(.cold); + if (builtin.zig_backend == .stage2_riscv64) { + // https://github.com/ziglang/zig/issues/21519 + @trap(); + } panic(.{ .start_index_greater_than_end = .{ .start = start, .end = end, @@ -885,6 +901,10 @@ pub fn panicStartGreaterThanEnd(start: usize, end: usize) noreturn { pub fn panicInactiveUnionField(active: anytype, accessed: @TypeOf(active)) noreturn { @branchHint(.cold); + if (builtin.zig_backend == .stage2_riscv64) { + // https://github.com/ziglang/zig/issues/21519 + @trap(); + } panic(.{ .inactive_union_field = .{ .active = @tagName(active), .accessed = @tagName(accessed), diff --git a/lib/std/debug.zig b/lib/std/debug.zig index 7bfc6b321e..98bf6b1fd4 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -629,6 +629,11 @@ pub fn fmtPanicCause(buffer: []u8, cause: std.builtin.PanicCause) usize { }, .sentinel_mismatch_other => i += fmtBuf(buffer[i..], "sentinel mismatch"), .unwrap_error => |err| { + if (builtin.zig_backend == .stage2_riscv64) { + // https://github.com/ziglang/zig/issues/21519 + i += fmtBuf(buffer[i..], "attempt to unwrap error"); + return i; + } i += fmtBuf(buffer[i..], "attempt to unwrap error: "); i += fmtBuf(buffer[i..], @errorName(err)); }, |
