Commit 5b1a9fbb45
Changed files (2)
src/crash_report.zig
@@ -13,11 +13,23 @@ const Sema = @import("Sema.zig");
const InternPool = @import("InternPool.zig");
const Zir = std.zig.Zir;
const Decl = Zcu.Decl;
+const dev = @import("dev.zig");
/// To use these crash report diagnostics, publish this panic in your main file
/// and add `pub const enable_segfault_handler = false;` to your `std_options`.
/// You will also need to call initialize() on startup, preferably as the very first operation in your program.
-pub const panic = if (build_options.enable_debug_extensions) compilerPanic else std.debug.defaultPanic;
+pub const Panic = if (build_options.enable_debug_extensions) struct {
+ pub const call = compilerPanic;
+ pub const sentinelMismatch = std.debug.FormattedPanic.sentinelMismatch;
+ pub const unwrapError = std.debug.FormattedPanic.unwrapError;
+ pub const outOfBounds = std.debug.FormattedPanic.outOfBounds;
+ pub const startGreaterThanEnd = std.debug.FormattedPanic.startGreaterThanEnd;
+ pub const inactiveUnionField = std.debug.FormattedPanic.inactiveUnionField;
+ pub const messages = std.debug.FormattedPanic.messages;
+} else if (dev.env == .bootstrap)
+ std.debug.SimplePanic
+else
+ std.debug.FormattedPanic;
/// Install signal handlers to identify crashes and report diagnostics.
pub fn initialize() void {
src/main.zig
@@ -44,8 +44,7 @@ pub const std_options = .{
},
};
-// Crash report needs to override the panic handler
-pub const panic = crash_report.panic;
+pub const Panic = crash_report.Panic;
var wasi_preopens: fs.wasi.Preopens = undefined;
pub fn wasi_cwd() std.os.wasi.fd_t {