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
This commit is contained in:
Ryan Liptak 2023-09-22 15:55:19 -07:00 committed by Andrew Kelley
parent ce919ccf45
commit 865b2e259b

View File

@ -4056,9 +4056,26 @@ fn reportRetryableWin32ResourceError(
) error{OutOfMemory}!void {
win32_resource.status = .failure_retryable;
// TODO: something
_ = comp;
_ = @errorName(err);
var bundle: ErrorBundle.Wip = undefined;
try bundle.init(comp.gpa);
errdefer bundle.deinit();
try bundle.addRootErrorMessage(.{
.msg = try bundle.printString("{s}", .{@errorName(err)}),
.src_loc = try bundle.addSourceLocation(.{
.src_path = try bundle.addString(win32_resource.src.src_path),
.line = 0,
.column = 0,
.span_start = 0,
.span_main = 0,
.span_end = 0,
}),
});
const finished_bundle = try bundle.toOwnedBundle("");
{
comp.mutex.lock();
defer comp.mutex.unlock();
try comp.failed_win32_resources.putNoClobber(comp.gpa, win32_resource, finished_bundle);
}
}
fn reportRetryableAstGenError(