authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-05-16 13:37:30+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-05-17 00:36:54+02:00
log721821804038d54cb0c0337fee03591545450310
tree5d35752e6c6f20507d42e56ab60aa74aaf6d3a2d
parentf377ea10609c1d3fb82688c51483821e318bd007
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

build runner: don't incorrectly omit reference traces

It's incorrect to ever set `include_reference_trace` here, because the compiler has already given or not given reference traces depending on the `-freference-trace` option propagated to the compiler process by `std.Build.Step.Compile`. Perhaps in future we could make the compiler always return the reference trace when communicating over the compiler protocol; that'd be more versatile than the current behavior, because the build runner could, for instance, show a reference trace on-demand without having to even invoke the compiler. That seems really useful, since the reference trace is *often* unnecessary noise, but *sometimes* essential. However, we don't live in that world right now, so passing the option here doesn't make sense. Resolves: #23415

1 files changed, 2 insertions(+), 6 deletions(-)

lib/compiler/build_runner.zig+2-6
...@@ -740,7 +740,7 @@ fn runStepNames(...@@ -740,7 +740,7 @@ fn runStepNames(
740 if (run.prominent_compile_errors and total_compile_errors > 0) {740 if (run.prominent_compile_errors and total_compile_errors > 0) {
741 for (step_stack.keys()) |s| {741 for (step_stack.keys()) |s| {
742 if (s.result_error_bundle.errorMessageCount() > 0) {742 if (s.result_error_bundle.errorMessageCount() > 0) {
743 s.result_error_bundle.renderToStdErr(.{ .ttyconf = ttyconf, .include_reference_trace = (b.reference_trace orelse 0) > 0 });743 s.result_error_bundle.renderToStdErr(.{ .ttyconf = ttyconf });
744 }744 }
745 }745 }
746746
...@@ -1119,11 +1119,7 @@ fn workerMakeOneStep(...@@ -1119,11 +1119,7 @@ fn workerMakeOneStep(
1119 defer std.debug.unlockStdErr();1119 defer std.debug.unlockStdErr();
11201120
1121 const gpa = b.allocator;1121 const gpa = b.allocator;
1122 const options: std.zig.ErrorBundle.RenderOptions = .{1122 printErrorMessages(gpa, s, .{ .ttyconf = run.ttyconf }, run.stderr, run.prominent_compile_errors) catch {};
1123 .ttyconf = run.ttyconf,
1124 .include_reference_trace = (b.reference_trace orelse 0) > 0,
1125 };
1126 printErrorMessages(gpa, s, options, run.stderr, run.prominent_compile_errors) catch {};
1127 }1123 }
11281124
1129 handle_result: {1125 handle_result: {