mirror of
https://github.com/ziglang/zig.git
synced 2025-12-09 15:53:08 +00:00
stage2: more debuggable panics
For now these errors are handled via `@panic` rather than `unreachable`. These are relatively likely bugs to occur at this early stage of development, and handling them as panics lets us ship release builds of the compiler without worrying about undefined behavior. Furthermore, in stage1, `@panic` is implemented to include an error return trace, while `unreachable` is not. In this case, the error return traces are extremely helpful in debugging the compiler.
This commit is contained in:
parent
786e238a7f
commit
c7dc451a2a
@ -3792,8 +3792,8 @@ pub fn analyzeFnBody(mod: *Module, decl: *Decl, func: *Fn) SemaError!Air {
|
|||||||
log.debug("set {s} to in_progress", .{decl.name});
|
log.debug("set {s} to in_progress", .{decl.name});
|
||||||
|
|
||||||
_ = sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
|
_ = sema.analyzeBody(&inner_block, fn_info.body) catch |err| switch (err) {
|
||||||
error.NeededSourceLocation => unreachable,
|
error.NeededSourceLocation => @panic("zig compiler bug: NeededSourceLocation"),
|
||||||
error.GenericPoison => unreachable,
|
error.GenericPoison => @panic("zig compiler bug: GenericPoison"),
|
||||||
else => |e| return e,
|
else => |e| return e,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user