| ... | ... | @@ -671,7 +671,12 @@ pub const PanicFn = fn ([]const u8, ?*StackTrace) noreturn; |
| 671 | 671 | |
| 672 | 672 | /// This function is used by the Zig language code generation and |
| 673 | 673 | /// therefore must be kept in sync with the compiler implementation. |
| 674 | | pub const panic: PanicFn = if (@hasDecl(root, "panic")) root.panic else default_panic; |
| 674 | pub const panic: PanicFn = if (@hasDecl(root, "panic")) |
| 675 | root.panic |
| 676 | else if (@hasDecl(root, "os") and @hasDecl(root.os, "panic")) |
| 677 | root.os.panic |
| 678 | else |
| 679 | default_panic; |
| 675 | 680 | |
| 676 | 681 | /// This function is used by the Zig language code generation and |
| 677 | 682 | /// 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 |
| 684 | 689 | @breakpoint(); |
| 685 | 690 | } |
| 686 | 691 | } |
| 687 | | if (@hasDecl(root, "os") and @hasDecl(root.os, "panic")) { |
| 688 | | root.os.panic(msg, error_return_trace); |
| 689 | | unreachable; |
| 690 | | } |
| 691 | 692 | switch (os.tag) { |
| 692 | 693 | .freestanding => { |
| 693 | 694 | while (true) { |