authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-09-22 15:55:19-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-23 11:01:02-07:00
log865b2e259bf78dbf1d4c1051b5fff68b90bca65f
treede416537f668fbcabd9195485b741094c4f33541
parentce919ccf45951856a762ffdb8ef850301cd8c588

Fix reportRetryableWin32ResourceError

Follow up to https://github.com/ziglang/zig/pull/17069. This TODO being left in was a complete oversight. Before, any 'retryable' error would hit: error: thread 2920 panic: access of union field 'success' while field 'failure_retryable' is active Now, it will be reported/handled properly: C:\Users\Ryan\Programming\Zig\zig\test\standalone\windows_resources\res\zig.rc:1:1: error: FileNotFound

1 files changed, 20 insertions(+), 3 deletions(-)

src/Compilation.zig+20-3
...@@ -4056,9 +4056,26 @@ fn reportRetryableWin32ResourceError(...@@ -4056,9 +4056,26 @@ fn reportRetryableWin32ResourceError(
4056) error{OutOfMemory}!void {4056) error{OutOfMemory}!void {
4057 win32_resource.status = .failure_retryable;4057 win32_resource.status = .failure_retryable;
40584058
4059 // TODO: something4059 var bundle: ErrorBundle.Wip = undefined;
4060 _ = comp;4060 try bundle.init(comp.gpa);
4061 _ = @errorName(err);4061 errdefer bundle.deinit();
4062 try bundle.addRootErrorMessage(.{
4063 .msg = try bundle.printString("{s}", .{@errorName(err)}),
4064 .src_loc = try bundle.addSourceLocation(.{
4065 .src_path = try bundle.addString(win32_resource.src.src_path),
4066 .line = 0,
4067 .column = 0,
4068 .span_start = 0,
4069 .span_main = 0,
4070 .span_end = 0,
4071 }),
4072 });
4073 const finished_bundle = try bundle.toOwnedBundle("");
4074 {
4075 comp.mutex.lock();
4076 defer comp.mutex.unlock();
4077 try comp.failed_win32_resources.putNoClobber(comp.gpa, win32_resource, finished_bundle);
4078 }
4062}4079}
40634080
4064fn reportRetryableAstGenError(4081fn reportRetryableAstGenError(