update test cases to new panic API

This commit is contained in:
Andrew Kelley 2024-09-25 20:17:21 -07:00
parent e8887829ca
commit 231783f207
86 changed files with 255 additions and 186 deletions

View File

@ -6,7 +6,10 @@ export fn foo() void {
@panic("oh no");
}
pub fn panic(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, ert: ?*std.builtin.StackTrace, ra: ?usize) noreturn {
_ = cause;
_ = ert;
_ = ra;
@compileError("panic");
}
@ -14,4 +17,4 @@ pub fn panic(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
// backend=stage2
// target=native
//
// :10:5: error: panic
// :13:5: error: panic

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "incorrect alignment")) {
if (cause == .incorrect_alignment) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "invalid enum value")) {
if (cause == .invalid_enum_value) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "invalid error code")) {
if (cause == .invalid_error_code) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "invalid error code")) {
if (cause == .invalid_error_code) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer cast truncated bits")) {
if (cause == .cast_truncated_data) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
if (cause == .integer_part_out_of_bounds) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
if (cause == .integer_part_out_of_bounds) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
if (cause == .integer_part_out_of_bounds) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
if (cause == .cast_to_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
if (cause == .cast_to_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "incorrect alignment")) {
if (cause == .incorrect_alignment) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "invalid enum value")) {
if (cause == .invalid_enum_value) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "invalid enum value")) {
if (cause == .invalid_enum_value) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "sentinel mismatch: expected { 0, 0 }, found { 4, 4 }")) {
if (cause == .sentinel_mismatch_other) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {
std.process.exit(0);
switch (cause) {
.sentinel_mismatch_usize => |info| {
if (info.expected == 0 and info.found == 4) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,9 +1,16 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "access of union field 'float' while field 'int' is active")) {
std.process.exit(0);
switch (cause) {
.inactive_union_field => |info| {
if (std.mem.eql(u8, info.active, "int") and
std.mem.eql(u8, info.accessed, "float"))
{
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "oh no")) {
std.process.exit(0);
switch (cause) {
.explicit_call => |message| {
if (std.mem.eql(u8, message, "oh no")) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "exact division produced remainder")) {
if (cause == .exact_division_remainder) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "invalid error code")) {
if (cause == .invalid_error_code) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "index out of bounds: index 1, len 0")) {
std.process.exit(0);
switch (cause) {
.index_out_of_bounds => |info| {
if (info.index == 1 and info.len == 0) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "exact division produced remainder")) {
if (cause == .exact_division_remainder) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "exact division produced remainder")) {
if (cause == .exact_division_remainder) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "for loop over objects with non-equal lengths")) {
if (cause == .for_len_mismatch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "for loop over objects with non-equal lengths")) {
if (cause == .for_len_mismatch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "division by zero")) {
if (cause == .divide_by_zero) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "division by zero")) {
if (cause == .divide_by_zero) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "@memcpy arguments alias")) {
if (cause == .memcpy_alias) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "@memcpy arguments have non-equal lengths")) {
if (cause == .memcpy_len_mismatch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "division by zero")) {
if (cause == .divide_by_zero) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "division by zero")) {
if (cause == .divide_by_zero) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "'noreturn' function returned")) {
if (cause == .noreturn_returned) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to use null value")) {
if (cause == .unwrap_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to use null value")) {
if (cause == .unwrap_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "index out of bounds: index 16, len 5")) {
std.process.exit(0);
switch (cause) {
.index_out_of_bounds => |info| {
if (info.index == 16 and info.len == 5) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "index out of bounds: index 4, len 4")) {
std.process.exit(0);
switch (cause) {
.index_out_of_bounds => |info| {
if (info.index == 4 and info.len == 4) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
if (cause == .cast_to_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
if (cause == .cast_to_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {
std.process.exit(0);
switch (cause) {
.sentinel_mismatch_usize => |info| {
if (info.expected == 0 and info.found == 4) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "division by zero")) {
if (cause == .divide_by_zero) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "shift amount is greater than the type size")) {
if (cause == .shift_rhs_too_big) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "shift amount is greater than the type size")) {
if (cause == .shift_rhs_too_big) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) {
if (cause == .negative_to_unsigned) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) {
if (cause == .negative_to_unsigned) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "left shift overflowed bits")) {
if (cause == .shl_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "right shift overflowed bits")) {
if (cause == .shr_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) {
if (cause == .negative_to_unsigned) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "sentinel mismatch: expected 1.2e0, found 4e0")) {
if (cause == .sentinel_mismatch_other) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "sentinel mismatch: expected null, found i32@10")) {
if (cause == .sentinel_mismatch_other) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {
std.process.exit(0);
switch (cause) {
.sentinel_mismatch_usize => |info| {
if (info.expected == 0 and info.found == 4) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "start index 10 is larger than end index 1")) {
std.process.exit(0);
switch (cause) {
.start_index_greater_than_end => |info| {
if (info.start == 10 and info.end == 1) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {
std.process.exit(0);
switch (cause) {
.index_out_of_bounds => |info| {
if (info.index == 5 and info.len == 4) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {
std.process.exit(0);
switch (cause) {
.index_out_of_bounds => |info| {
if (info.index == 5 and info.len == 4) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to use null value")) {
if (cause == .unwrap_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to use null value")) {
if (cause == .unwrap_null) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "switch on corrupt value")) {
if (cause == .corrupt_switch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "switch on corrupt value")) {
if (cause == .corrupt_switch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "switch on corrupt value")) {
if (cause == .corrupt_switch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "switch on corrupt value")) {
if (cause == .corrupt_switch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "switch on corrupt value")) {
if (cause == .corrupt_switch) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer cast truncated bits")) {
if (cause == .cast_truncated_data) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,9 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, ret_addr: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
_ = ret_addr;
if (std.mem.eql(u8, message, "reached unreachable code")) {
if (cause == .reached_unreachable) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer cast truncated bits")) {
if (cause == .cast_truncated_data) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "left shift overflowed bits")) {
if (cause == .shl_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "right shift overflowed bits")) {
if (cause == .shr_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer cast truncated bits")) {
if (cause == .cast_truncated_data) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to unwrap error: Whatever")) {
std.process.exit(0);
switch (cause) {
.unwrap_error => |err| {
if (err == error.Whatever) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,9 +1,14 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "attempt to unwrap error: Whatever")) {
std.process.exit(0);
switch (cause) {
.unwrap_error => |err| {
if (err == error.Whatever) {
std.process.exit(0);
}
},
else => {},
}
std.process.exit(1);
}

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer cast truncated bits")) {
if (cause == .cast_truncated_data) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer cast truncated bits")) {
if (cause == .cast_truncated_data) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "integer overflow")) {
if (cause == .integer_overflow) {
std.process.exit(0);
}
std.process.exit(1);

View File

@ -1,8 +1,8 @@
const std = @import("std");
pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
pub fn panic(cause: std.builtin.PanicCause, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
_ = stack_trace;
if (std.mem.eql(u8, message, "invalid error code")) {
if (cause == .invalid_error_code) {
std.process.exit(0);
}
std.process.exit(1);