aboutsummaryrefslogtreecommitdiff
path: root/std/special/panic.zig
blob: 50dc5e0c65b1a09cc4e686a8dd866f9d333fe022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// This file is the default panic handler if the root source file does not
// have a `pub fn panic`.
// If this file wants to import other files *by name*, support for that would
// have to be added in the compiler.

const builtin = @import("builtin");
const std = @import("std");

pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn {
    const stderr = std.io.getStdErr() catch std.process.abort();
    stderr.write("panic: ") catch std.process.abort();
    stderr.write(msg) catch std.process.abort();
    std.process.abort();
}