authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-07 00:38:46-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-07-07 00:38:46-07:00
logd481acc7dbebb5501b5fef608ee1f6b13c442c6a
tree6d2a9778ce43f1a45be1133c4ed776629c7c1128
parent298a65ff4b4efc46c877309be22550f023f49758

std.builtin.panic: simpler default panic for stage2

until it catches up to stage1 in terms of supported language features

1 files changed, 7 insertions(+), 0 deletions(-)

lib/std/builtin.zig+7
...@@ -677,6 +677,13 @@ pub const panic: PanicFn = if (@hasDecl(root, "panic")) root.panic else default_...@@ -677,6 +677,13 @@ pub const panic: PanicFn = if (@hasDecl(root, "panic")) root.panic else default_
677/// therefore must be kept in sync with the compiler implementation.677/// therefore must be kept in sync with the compiler implementation.
678pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn {678pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn {
679 @setCold(true);679 @setCold(true);
680 // Until self-hosted catches up with stage1 language features, we have a simpler
681 // default panic function:
682 if (builtin.zig_is_stage2) {
683 while (true) {
684 @breakpoint();
685 }
686 }
680 if (@hasDecl(root, "os") and @hasDecl(root.os, "panic")) {687 if (@hasDecl(root, "os") and @hasDecl(root.os, "panic")) {
681 root.os.panic(msg, error_return_trace);688 root.os.panic(msg, error_return_trace);
682 unreachable;689 unreachable;