|
| 1 | +//! This namespace can be used with `pub const Panic = std.debug.NoPanic;` in the root file. |
| 2 | +//! It emits as little code as possible, for testing purposes. |
| 3 | +//! |
| 4 | +//! For a functional alternative, see `std.debug.FormattedPanic`. |
| 5 | + |
| 6 | +const std = @import("../std.zig"); |
| 7 | + |
| 8 | +pub fn call(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 9 | + @branchHint(.cold); |
| 10 | + @trap(); |
| 11 | +} |
| 12 | + |
| 13 | +pub inline fn sentinelMismatch(_: anytype, _: anytype) noreturn { |
| 14 | + @branchHint(.cold); |
| 15 | + @trap(); |
| 16 | +} |
| 17 | + |
| 18 | +pub inline fn unwrapError(_: ?*std.builtin.StackTrace, _: anyerror) noreturn { |
| 19 | + @branchHint(.cold); |
| 20 | + @trap(); |
| 21 | +} |
| 22 | + |
| 23 | +pub inline fn outOfBounds(_: usize, _: usize) noreturn { |
| 24 | + @branchHint(.cold); |
| 25 | + @trap(); |
| 26 | +} |
| 27 | + |
| 28 | +pub inline fn startGreaterThanEnd(_: usize, _: usize) noreturn { |
| 29 | + @branchHint(.cold); |
| 30 | + @trap(); |
| 31 | +} |
| 32 | + |
| 33 | +pub inline fn inactiveUnionField(_: anytype, _: anytype) noreturn { |
| 34 | + @branchHint(.cold); |
| 35 | + @trap(); |
| 36 | +} |
| 37 | + |
| 38 | +pub const messages = struct { |
| 39 | + pub const reached_unreachable = ""; |
| 40 | + pub const unwrap_null = ""; |
| 41 | + pub const cast_to_null = ""; |
| 42 | + pub const incorrect_alignment = ""; |
| 43 | + pub const invalid_error_code = ""; |
| 44 | + pub const cast_truncated_data = ""; |
| 45 | + pub const negative_to_unsigned = ""; |
| 46 | + pub const integer_overflow = ""; |
| 47 | + pub const shl_overflow = ""; |
| 48 | + pub const shr_overflow = ""; |
| 49 | + pub const divide_by_zero = ""; |
| 50 | + pub const exact_division_remainder = ""; |
| 51 | + pub const integer_part_out_of_bounds = ""; |
| 52 | + pub const corrupt_switch = ""; |
| 53 | + pub const shift_rhs_too_big = ""; |
| 54 | + pub const invalid_enum_value = ""; |
| 55 | + pub const for_len_mismatch = ""; |
| 56 | + pub const memcpy_len_mismatch = ""; |
| 57 | + pub const memcpy_alias = ""; |
| 58 | + pub const noreturn_returned = ""; |
| 59 | +}; |
0 commit comments