From 8adabaa4ed2321882e2ef04ebb2d9b621805aac2 Mon Sep 17 00:00:00 2001 From: mlugg Date: Fri, 15 Aug 2025 11:18:45 +0100 Subject: Zcu: don't tell linkers about exports if there are compile errors In the best case, this is redundant work, because we aren't actually going to emit a working binary this update. In the worst case, it causes bugs because the linker may not have *seen* the thing being exported due to the compile errors. Resolves: #24417 --- src/Compilation.zig | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 435919fce9..e340cb57f8 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -4254,14 +4254,10 @@ fn appendCompileLogLines(log_text: *std.ArrayListUnmanaged(u8), zcu: *Zcu, loggi } } -fn anyErrors(comp: *Compilation) bool { - return (totalErrorCount(comp) catch return true) != 0; -} - -fn totalErrorCount(comp: *Compilation) !u32 { - var errors = try comp.getAllErrorsAlloc(); +pub fn anyErrors(comp: *Compilation) bool { + var errors = comp.getAllErrorsAlloc() catch return true; defer errors.deinit(comp.gpa); - return errors.errorMessageCount(); + return errors.errorMessageCount() > 0; } pub const ErrorNoteHashContext = struct { -- cgit v1.2.3