| 1 | const simple_panic = std.debug.simple_panic; |
| 2 | pub const panic = struct { |
| 3 | pub fn call(msg: []const u8, bad: usize) noreturn { |
| 4 | _ = msg; |
| 5 | _ = bad; |
| 6 | @trap(); |
| 7 | } |
| 8 | pub const sentinelMismatch = simple_panic.sentinelMismatch; |
| 9 | pub const unwrapError = simple_panic.unwrapError; |
| 10 | pub const outOfBounds = simple_panic.outOfBounds; |
| 11 | pub const startGreaterThanEnd = simple_panic.startGreaterThanEnd; |
| 12 | pub const inactiveUnionField = simple_panic.inactiveUnionField; |
| 13 | pub const reachedUnreachable = simple_panic.reachedUnreachable; |
| 14 | pub const unwrapNull = simple_panic.unwrapNull; |
| 15 | pub const castToNull = simple_panic.castToNull; |
| 16 | pub const incorrectAlignment = simple_panic.incorrectAlignment; |
| 17 | pub const invalidErrorCode = simple_panic.invalidErrorCode; |
| 18 | pub const unexpectedErrorCode = simple_panic.unexpectedErrorCode; |
| 19 | pub const integerOutOfBounds = simple_panic.integerOutOfBounds; |
| 20 | pub const integerOverflow = simple_panic.integerOverflow; |
| 21 | pub const shlOverflow = simple_panic.shlOverflow; |
| 22 | pub const shrOverflow = simple_panic.shrOverflow; |
| 23 | pub const divideByZero = simple_panic.divideByZero; |
| 24 | pub const exactDivisionRemainder = simple_panic.exactDivisionRemainder; |
| 25 | pub const integerPartOutOfBounds = simple_panic.integerPartOutOfBounds; |
| 26 | pub const corruptSwitch = simple_panic.corruptSwitch; |
| 27 | pub const shiftRhsTooBig = simple_panic.shiftRhsTooBig; |
| 28 | pub const invalidEnumValue = simple_panic.invalidEnumValue; |
| 29 | pub const forLenMismatch = simple_panic.forLenMismatch; |
| 30 | pub const copyLenMismatch = simple_panic.copyLenMismatch; |
| 31 | pub const memcpyAlias = simple_panic.memcpyAlias; |
| 32 | pub const noreturnReturned = simple_panic.noreturnReturned; |
| 33 | }; |
| 34 | |
| 35 | export fn foo(a: u8) void { |
| 36 | @setRuntimeSafety(true); |
| 37 | _ = a + 1; // safety check to reference the panic handler |
| 38 | } |
| 39 | |
| 40 | const std = @import("std"); |
| 41 | |
| 42 | // error |
| 43 | // |
| 44 | // :3:9: error: expected type 'fn ([]const u8, ?usize) noreturn', found 'fn ([]const u8, usize) noreturn' |
| 45 | // :3:9: note: parameter 1 'usize' cannot cast into '?usize' |