From f6d22629aa6a7fbc5a2f285c335e1580bd4a3e24 Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sat, 27 Jun 2026 17:58:45 -0700 Subject: [PATCH] resinator: Make LazyIncludePaths actually retain resolved values The libc paths were being detected twice because of this stupid mistake --- lib/compiler/resinator/main.zig | 55 +++++++++++++++++---------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/lib/compiler/resinator/main.zig b/lib/compiler/resinator/main.zig index e962177015641502fdce3bcd6d9b6adf1195d0e3..98099c31ffddbad2a0f969ef3adbc903f54fc5f3 100644 --- a/lib/compiler/resinator/main.zig +++ b/lib/compiler/resinator/main.zig @@ -555,34 +555,35 @@ const LazyIncludePaths = struct { ) ![]const []const u8 { const io = self.io; - if (self.resolved_include_paths) |include_paths| - return include_paths; + if (self.resolved_include_paths == null) { + self.resolved_include_paths = getIncludePaths( + self.arena, + io, + self.auto_includes_option, + self.zig_lib_dir, + self.target_machine_type, + environ_map, + ) catch |err| switch (err) { + error.OutOfMemory => |e| return e, + else => |e| { + switch (e) { + error.UnsupportedAutoIncludesMachineType => { + try error_handler.emitMessage(self.arena, io, .err, "automatic include path detection is not supported for target '{s}'", .{@tagName(self.target_machine_type)}); + }, + error.MsvcIncludesNotFound => { + try error_handler.emitMessage(self.arena, io, .err, "MSVC include paths could not be automatically detected", .{}); + }, + error.MingwIncludesNotFound => { + try error_handler.emitMessage(self.arena, io, .err, "MinGW include paths could not be automatically detected", .{}); + }, + } + try error_handler.emitMessage(self.arena, io, .note, "to disable auto includes, use the option /:auto-includes none", .{}); + std.process.exit(1); + }, + }; + } - return getIncludePaths( - self.arena, - io, - self.auto_includes_option, - self.zig_lib_dir, - self.target_machine_type, - environ_map, - ) catch |err| switch (err) { - error.OutOfMemory => |e| return e, - else => |e| { - switch (e) { - error.UnsupportedAutoIncludesMachineType => { - try error_handler.emitMessage(self.arena, io, .err, "automatic include path detection is not supported for target '{s}'", .{@tagName(self.target_machine_type)}); - }, - error.MsvcIncludesNotFound => { - try error_handler.emitMessage(self.arena, io, .err, "MSVC include paths could not be automatically detected", .{}); - }, - error.MingwIncludesNotFound => { - try error_handler.emitMessage(self.arena, io, .err, "MinGW include paths could not be automatically detected", .{}); - }, - } - try error_handler.emitMessage(self.arena, io, .note, "to disable auto includes, use the option /:auto-includes none", .{}); - std.process.exit(1); - }, - }; + return self.resolved_include_paths.?; } }; -- 2.54.0