From 87fb7df25794d12b2316dd41a9111e2206c00152 Mon Sep 17 00:00:00 2001 From: Mason Remaley Date: Sat, 11 Apr 2026 18:20:26 -0700 Subject: [PATCH] Updates stack trace vs error return trace in more places --- doc/langref.html.in | 2 +- lib/compiler/test_runner.zig | 6 +++--- lib/std/Thread.zig | 4 ++-- lib/std/std.zig | 2 ++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/langref.html.in b/doc/langref.html.in index 9f32e05896..1974d76791 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -3263,7 +3263,7 @@ fn createFoo(param: i32) !Foo { {#header_open|Implementation Details#}

diff --git a/lib/compiler/test_runner.zig b/lib/compiler/test_runner.zig index fd4ac20eb0..2a5483907e 100644 --- a/lib/compiler/test_runner.zig +++ b/lib/compiler/test_runner.zig @@ -144,7 +144,7 @@ fn mainServer(init: std.process.Init.Minimal) !void { error.SkipZigTest => .skip, else => s: { if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace); + std.debug.dumpErrorReturnTrace(trace); } break :s .fail; }, @@ -312,7 +312,7 @@ fn mainTerminal(init: std.process.Init.Minimal) void { std.debug.print("FAIL ({t})\n", .{err}); } if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace); + std.debug.dumpErrorReturnTrace(trace); } test_node.end(); }, @@ -438,7 +438,7 @@ var fuzz_runner: if (builtin.fuzz) struct { error.SkipZigTest => return, else => { if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace); + std.debug.dumpErrorReturnTrace(trace); } std.debug.print("failed with error.{t}\n", .{err}); std.process.exit(1); diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index 8f31add6e2..6e9f7fb540 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -442,7 +442,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { @call(.auto, f, args) catch |err| { std.debug.print("error: {s}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace); + std.debug.dumpErrorReturnTrace(trace); } }; @@ -932,7 +932,7 @@ const WasiThreadImpl = struct { @call(.auto, f, w.args) catch |err| { std.debug.print("error: {s}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { - std.debug.dumpStackTrace(trace); + std.debug.dumpErrorReturnTrace(trace); } }; }, diff --git a/lib/std/std.zig b/lib/std/std.zig index 5cb856f9cc..e700c728c1 100644 --- a/lib/std/std.zig +++ b/lib/std/std.zig @@ -165,6 +165,8 @@ pub const Options = struct { /// * `debug.dumpCurrentStackTrace` /// * `debug.writeStackTrace` /// * `debug.dumpStackTrace` + /// * `debug.writeErrorReturnTrace` + /// * `debug.dumpErrorReturnTrace` /// /// Stack traces can generally be collected and printed when debug info is stripped, but are /// often less useful since they usually cannot be mapped to source locations and/or have bad