From f7fe61194beb8b41bc0e7093f462f5fd217e1c47 Mon Sep 17 00:00:00 2001 From: Eric Joldasov Date: Sun, 9 Feb 2025 13:21:04 +0500 Subject: [PATCH] update to new panic interface See https://github.com/ziglang/zig/pull/22594 . Signed-off-by: Eric Joldasov --- src/main.zig | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main.zig b/src/main.zig index e05f3cc..061db90 100644 --- a/src/main.zig +++ b/src/main.zig @@ -62,12 +62,13 @@ pub const allocator = std.mem.Allocator{ // Custom panic impl to reset the terminal before spewing out an error message. -pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn { - @branchHint(.cold); - ui.deinit(); - std.debug.panicImpl(error_return_trace, ret_addr orelse @returnAddress(), msg); -} - +pub const panic = std.debug.FullPanic(struct { + pub fn panicFn(msg: []const u8, first_trace_addr: ?usize) noreturn { + @branchHint(.cold); + ui.deinit(); + std.debug.defaultPanic(msg, first_trace_addr); + } +}.panicFn); pub const config = struct { pub const SortCol = enum { name, blocks, size, items, mtime };