aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-02-23 19:21:44 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-03-15 10:48:13 -0700
commit6f717b18f05ba02439603e0987e9c9551fbadedb (patch)
treec95613ef714eed338372d1947c0132808beffab4 /src/Sema.zig
parent572cb24d1a4f70c662ddf17df72d27dec44bc4fc (diff)
downloadzig-6f717b18f05ba02439603e0987e9c9551fbadedb.tar.gz
zig-6f717b18f05ba02439603e0987e9c9551fbadedb.zip
std.zig.ErrorBundle: rework binary encoding
* Separate into a "WIP" struct and a "finished" struct. * Use a bit of indirection for error notes to simplify ergonomics of this data structure.
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 237936547e..03ebbbdbac 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -2215,11 +2215,12 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError {
if (crash_report.is_enabled and sema.mod.comp.debug_compile_errors) {
if (err_msg.src_loc.lazy == .unneeded) return error.NeededSourceLocation;
- var errors: std.zig.ErrorBundle = undefined;
- errors.init(gpa) catch unreachable;
- Compilation.addModuleErrorMsg(gpa, &errors, err_msg.*) catch unreachable;
+ var wip_errors: std.zig.ErrorBundle.Wip = undefined;
+ wip_errors.init(gpa) catch unreachable;
+ Compilation.addModuleErrorMsg(&wip_errors, err_msg.*) catch unreachable;
std.debug.print("compile error during Sema:\n", .{});
- errors.renderToStdErr(.no_color);
+ var error_bundle = wip_errors.toOwnedBundle() catch unreachable;
+ error_bundle.renderToStdErr(.no_color);
crash_report.compilerPanic("unexpected compile error occurred", null, null);
}