aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-12 19:04:35 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:09 -0800
commit1925e0319f1337b4856bd5a181bf4f6d3ac7d428 (patch)
treeb38839cca2604368b01b4312119083a5cdf3d224 /src/Sema.zig
parentec56696503e702e063af8740a77376b2e7694c29 (diff)
downloadzig-1925e0319f1337b4856bd5a181bf4f6d3ac7d428.tar.gz
zig-1925e0319f1337b4856bd5a181bf4f6d3ac7d428.zip
update lockStderrWriter sites
use the application's Io implementation where possible. This correctly makes writing to stderr cancelable, fallible, and participate in the application's event loop. It also removes one more hard-coded dependency on a secondary Io implementation.
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index fec6850c4c..1f6a577f60 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -2668,16 +2668,18 @@ fn failWithTypeMismatch(sema: *Sema, block: *Block, src: LazySrcLoc, expected: T
pub fn failWithOwnedErrorMsg(sema: *Sema, block: ?*Block, err_msg: *Zcu.ErrorMsg) error{ AnalysisFail, OutOfMemory } {
@branchHint(.cold);
- const gpa = sema.gpa;
const zcu = sema.pt.zcu;
+ const comp = zcu.comp;
+ const gpa = comp.gpa;
+ const io = comp.io;
- if (build_options.enable_debug_extensions and zcu.comp.debug_compile_errors) {
+ if (build_options.enable_debug_extensions and comp.debug_compile_errors) {
var wip_errors: std.zig.ErrorBundle.Wip = undefined;
wip_errors.init(gpa) catch @panic("out of memory");
Compilation.addModuleErrorMsg(zcu, &wip_errors, err_msg.*, false) catch @panic("out of memory");
std.debug.print("compile error during Sema:\n", .{});
var error_bundle = wip_errors.toOwnedBundle("") catch @panic("out of memory");
- error_bundle.renderToStdErr(.{}, .auto);
+ error_bundle.renderToStderr(io, .{}, .auto);
std.debug.panicExtra(@returnAddress(), "unexpected compile error occurred", .{});
}