authorgravatar for greenblattryan@gmail.comrgreenblatt <greenblattryan@gmail.com> 2021-06-26 10:35:39-05:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2021-08-20 19:37:53+03:00
log2f1abd919a8465e515875cd08816778df795aabe
tree4c8e605e1792dfed207954f43ecbe0ad1445647b
parentb2e970d157343919ea2be44b3ebe4c519324bd4e

Fix issue where root.os.panic could return


1 files changed, 6 insertions(+), 5 deletions(-)

lib/std/builtin.zig+6-5
......@@ -671,7 +671,12 @@ pub const PanicFn = fn ([]const u8, ?*StackTrace) noreturn;
671671
672672/// This function is used by the Zig language code generation and
673673/// therefore must be kept in sync with the compiler implementation.
674pub const panic: PanicFn = if (@hasDecl(root, "panic")) root.panic else default_panic;
674pub const panic: PanicFn = if (@hasDecl(root, "panic"))
675 root.panic
676else if (@hasDecl(root, "os") and @hasDecl(root.os, "panic"))
677 root.os.panic
678else
679 default_panic;
675680
676681/// This function is used by the Zig language code generation and
677682/// therefore must be kept in sync with the compiler implementation.
......@@ -684,10 +689,6 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn
684689 @breakpoint();
685690 }
686691 }
687 if (@hasDecl(root, "os") and @hasDecl(root.os, "panic")) {
688 root.os.panic(msg, error_return_trace);
689 unreachable;
690 }
691692 switch (os.tag) {
692693 .freestanding => {
693694 while (true) {