aboutsummaryrefslogtreecommitdiff
path: root/lib/std/builtin.zig
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/builtin.zig')
-rw-r--r--lib/std/builtin.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 36fa46e953..687e169bbe 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -414,6 +414,13 @@ pub const CallOptions = struct {
/// This function type is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
+pub const TestFn = struct {
+ name: []const u8,
+ func: fn()anyerror!void,
+};
+
+/// This function type is used by the Zig language code generation and
+/// therefore must be kept in sync with the compiler implementation.
pub const PanicFn = fn ([]const u8, ?*StackTrace) noreturn;
/// This function is used by the Zig language code generation and
@@ -424,6 +431,10 @@ pub const panic: PanicFn = if (@hasDecl(root, "panic")) root.panic else default_
/// therefore must be kept in sync with the compiler implementation.
pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn {
@setCold(true);
+ if (@hasDecl(root, "os") and @hasDecl(root.os, "panic")) {
+ root.os.panic(msg, error_return_trace);
+ unreachable;
+ }
switch (os) {
.freestanding => {
while (true) {