authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-01-24 04:20:55+00:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-01-24 22:33:23+00:00
log5a6666db5502079d9800ae3d41b790646238078e
tree7f7ce3014e7c35c50dc35b0a5296da590dbb0d05
parentdd334d5ee5344cfe773047ceeca6cbcfc896f57c
signaturelock-open Commit is signed but in an unrecognized format.

all: update for `panic.unwrapError` and `panic.call` signature changes


10 files changed, 79 insertions(+), 80 deletions(-)

lib/std/builtin.zig+6-1
...@@ -1117,7 +1117,12 @@ pub const PanicFn = fn ([]const u8, ?*StackTrace, ?usize) noreturn;...@@ -1117,7 +1117,12 @@ pub const PanicFn = fn ([]const u8, ?*StackTrace, ?usize) noreturn;
1117pub const panic: type = p: {1117pub const panic: type = p: {
1118 if (@hasDecl(root, "panic")) {1118 if (@hasDecl(root, "panic")) {
1119 if (@TypeOf(root.panic) != type) {1119 if (@TypeOf(root.panic) != type) {
1120 break :p std.debug.FullPanic(root.panic); // Deprecated; make `panic` a namespace instead.1120 // Deprecated; make `panic` a namespace instead.
1121 break :p std.debug.FullPanic(struct {
1122 fn panic(msg: []const u8, ra: ?usize) noreturn {
1123 root.panic(msg, @errorReturnTrace(), ra);
1124 }
1125 }.panic);
1121 }1126 }
1122 break :p root.panic;1127 break :p root.panic;
1123 }1128 }
lib/std/debug.zig+31-33
...@@ -27,112 +27,112 @@ pub const no_panic = @import("debug/no_panic.zig");...@@ -27,112 +27,112 @@ pub const no_panic = @import("debug/no_panic.zig");
27/// A fully-featured panic handler namespace which lowers all panics to calls to `panicFn`.27/// A fully-featured panic handler namespace which lowers all panics to calls to `panicFn`.
28/// Safety panics will use formatted printing to provide a meaningful error message.28/// Safety panics will use formatted printing to provide a meaningful error message.
29/// The signature of `panicFn` should match that of `defaultPanic`.29/// The signature of `panicFn` should match that of `defaultPanic`.
30pub fn FullPanic(comptime panicFn: fn ([]const u8, ?*std.builtin.StackTrace, ?usize) noreturn) type {30pub fn FullPanic(comptime panicFn: fn ([]const u8, ?usize) noreturn) type {
31 return struct {31 return struct {
32 pub const call = panicFn;32 pub const call = panicFn;
33 pub fn sentinelMismatch(expected: anytype, found: @TypeOf(expected)) noreturn {33 pub fn sentinelMismatch(expected: anytype, found: @TypeOf(expected)) noreturn {
34 @branchHint(.cold);34 @branchHint(.cold);
35 std.debug.panicExtra(null, @returnAddress(), "sentinel mismatch: expected {any}, found {any}", .{35 std.debug.panicExtra(@returnAddress(), "sentinel mismatch: expected {any}, found {any}", .{
36 expected, found,36 expected, found,
37 });37 });
38 }38 }
39 pub fn unwrapError(ert: ?*std.builtin.StackTrace, err: anyerror) noreturn {39 pub fn unwrapError(err: anyerror) noreturn {
40 @branchHint(.cold);40 @branchHint(.cold);
41 std.debug.panicExtra(ert, @returnAddress(), "attempt to unwrap error: {s}", .{@errorName(err)});41 std.debug.panicExtra(@returnAddress(), "attempt to unwrap error: {s}", .{@errorName(err)});
42 }42 }
43 pub fn outOfBounds(index: usize, len: usize) noreturn {43 pub fn outOfBounds(index: usize, len: usize) noreturn {
44 @branchHint(.cold);44 @branchHint(.cold);
45 std.debug.panicExtra(null, @returnAddress(), "index out of bounds: index {d}, len {d}", .{ index, len });45 std.debug.panicExtra(@returnAddress(), "index out of bounds: index {d}, len {d}", .{ index, len });
46 }46 }
47 pub fn startGreaterThanEnd(start: usize, end: usize) noreturn {47 pub fn startGreaterThanEnd(start: usize, end: usize) noreturn {
48 @branchHint(.cold);48 @branchHint(.cold);
49 std.debug.panicExtra(null, @returnAddress(), "start index {d} is larger than end index {d}", .{ start, end });49 std.debug.panicExtra(@returnAddress(), "start index {d} is larger than end index {d}", .{ start, end });
50 }50 }
51 pub fn inactiveUnionField(active: anytype, accessed: @TypeOf(active)) noreturn {51 pub fn inactiveUnionField(active: anytype, accessed: @TypeOf(active)) noreturn {
52 @branchHint(.cold);52 @branchHint(.cold);
53 std.debug.panicExtra(null, @returnAddress(), "access of union field '{s}' while field '{s}' is active", .{53 std.debug.panicExtra(@returnAddress(), "access of union field '{s}' while field '{s}' is active", .{
54 @tagName(accessed), @tagName(active),54 @tagName(accessed), @tagName(active),
55 });55 });
56 }56 }
57 pub fn reachedUnreachable() noreturn {57 pub fn reachedUnreachable() noreturn {
58 @branchHint(.cold);58 @branchHint(.cold);
59 call("reached unreachable code", null, @returnAddress());59 call("reached unreachable code", @returnAddress());
60 }60 }
61 pub fn unwrapNull() noreturn {61 pub fn unwrapNull() noreturn {
62 @branchHint(.cold);62 @branchHint(.cold);
63 call("attempt to use null value", null, @returnAddress());63 call("attempt to use null value", @returnAddress());
64 }64 }
65 pub fn castToNull() noreturn {65 pub fn castToNull() noreturn {
66 @branchHint(.cold);66 @branchHint(.cold);
67 call("cast causes pointer to be null", null, @returnAddress());67 call("cast causes pointer to be null", @returnAddress());
68 }68 }
69 pub fn incorrectAlignment() noreturn {69 pub fn incorrectAlignment() noreturn {
70 @branchHint(.cold);70 @branchHint(.cold);
71 call("incorrect alignment", null, @returnAddress());71 call("incorrect alignment", @returnAddress());
72 }72 }
73 pub fn invalidErrorCode() noreturn {73 pub fn invalidErrorCode() noreturn {
74 @branchHint(.cold);74 @branchHint(.cold);
75 call("invalid error code", null, @returnAddress());75 call("invalid error code", @returnAddress());
76 }76 }
77 pub fn castTruncatedData() noreturn {77 pub fn castTruncatedData() noreturn {
78 @branchHint(.cold);78 @branchHint(.cold);
79 call("integer cast truncated bits", null, @returnAddress());79 call("integer cast truncated bits", @returnAddress());
80 }80 }
81 pub fn negativeToUnsigned() noreturn {81 pub fn negativeToUnsigned() noreturn {
82 @branchHint(.cold);82 @branchHint(.cold);
83 call("attempt to cast negative value to unsigned integer", null, @returnAddress());83 call("attempt to cast negative value to unsigned integer", @returnAddress());
84 }84 }
85 pub fn integerOverflow() noreturn {85 pub fn integerOverflow() noreturn {
86 @branchHint(.cold);86 @branchHint(.cold);
87 call("integer overflow", null, @returnAddress());87 call("integer overflow", @returnAddress());
88 }88 }
89 pub fn shlOverflow() noreturn {89 pub fn shlOverflow() noreturn {
90 @branchHint(.cold);90 @branchHint(.cold);
91 call("left shift overflowed bits", null, @returnAddress());91 call("left shift overflowed bits", @returnAddress());
92 }92 }
93 pub fn shrOverflow() noreturn {93 pub fn shrOverflow() noreturn {
94 @branchHint(.cold);94 @branchHint(.cold);
95 call("right shift overflowed bits", null, @returnAddress());95 call("right shift overflowed bits", @returnAddress());
96 }96 }
97 pub fn divideByZero() noreturn {97 pub fn divideByZero() noreturn {
98 @branchHint(.cold);98 @branchHint(.cold);
99 call("division by zero", null, @returnAddress());99 call("division by zero", @returnAddress());
100 }100 }
101 pub fn exactDivisionRemainder() noreturn {101 pub fn exactDivisionRemainder() noreturn {
102 @branchHint(.cold);102 @branchHint(.cold);
103 call("exact division produced remainder", null, @returnAddress());103 call("exact division produced remainder", @returnAddress());
104 }104 }
105 pub fn integerPartOutOfBounds() noreturn {105 pub fn integerPartOutOfBounds() noreturn {
106 @branchHint(.cold);106 @branchHint(.cold);
107 call("integer part of floating point value out of bounds", null, @returnAddress());107 call("integer part of floating point value out of bounds", @returnAddress());
108 }108 }
109 pub fn corruptSwitch() noreturn {109 pub fn corruptSwitch() noreturn {
110 @branchHint(.cold);110 @branchHint(.cold);
111 call("switch on corrupt value", null, @returnAddress());111 call("switch on corrupt value", @returnAddress());
112 }112 }
113 pub fn shiftRhsTooBig() noreturn {113 pub fn shiftRhsTooBig() noreturn {
114 @branchHint(.cold);114 @branchHint(.cold);
115 call("shift amount is greater than the type size", null, @returnAddress());115 call("shift amount is greater than the type size", @returnAddress());
116 }116 }
117 pub fn invalidEnumValue() noreturn {117 pub fn invalidEnumValue() noreturn {
118 @branchHint(.cold);118 @branchHint(.cold);
119 call("invalid enum value", null, @returnAddress());119 call("invalid enum value", @returnAddress());
120 }120 }
121 pub fn forLenMismatch() noreturn {121 pub fn forLenMismatch() noreturn {
122 @branchHint(.cold);122 @branchHint(.cold);
123 call("for loop over objects with non-equal lengths", null, @returnAddress());123 call("for loop over objects with non-equal lengths", @returnAddress());
124 }124 }
125 pub fn memcpyLenMismatch() noreturn {125 pub fn memcpyLenMismatch() noreturn {
126 @branchHint(.cold);126 @branchHint(.cold);
127 call("@memcpy arguments have non-equal lengths", null, @returnAddress());127 call("@memcpy arguments have non-equal lengths", @returnAddress());
128 }128 }
129 pub fn memcpyAlias() noreturn {129 pub fn memcpyAlias() noreturn {
130 @branchHint(.cold);130 @branchHint(.cold);
131 call("@memcpy arguments alias", null, @returnAddress());131 call("@memcpy arguments alias", @returnAddress());
132 }132 }
133 pub fn noreturnReturned() noreturn {133 pub fn noreturnReturned() noreturn {
134 @branchHint(.cold);134 @branchHint(.cold);
135 call("'noreturn' function returned", null, @returnAddress());135 call("'noreturn' function returned", @returnAddress());
136 }136 }
137137
138 /// To be deleted after zig1.wasm update.138 /// To be deleted after zig1.wasm update.
...@@ -531,13 +531,12 @@ pub fn assertReadable(slice: []const volatile u8) void {...@@ -531,13 +531,12 @@ pub fn assertReadable(slice: []const volatile u8) void {
531/// Equivalent to `@panic` but with a formatted message.531/// Equivalent to `@panic` but with a formatted message.
532pub fn panic(comptime format: []const u8, args: anytype) noreturn {532pub fn panic(comptime format: []const u8, args: anytype) noreturn {
533 @branchHint(.cold);533 @branchHint(.cold);
534 panicExtra(@errorReturnTrace(), @returnAddress(), format, args);534 panicExtra(@returnAddress(), format, args);
535}535}
536536
537/// Equivalent to `@panic` but with a formatted message, and with an explicitly537/// Equivalent to `@panic` but with a formatted message, and with an explicitly
538/// provided `@errorReturnTrace` and return address.538/// provided return address.
539pub fn panicExtra(539pub fn panicExtra(
540 trace: ?*std.builtin.StackTrace,
541 ret_addr: ?usize,540 ret_addr: ?usize,
542 comptime format: []const u8,541 comptime format: []const u8,
543 args: anytype,542 args: anytype,
...@@ -556,7 +555,7 @@ pub fn panicExtra(...@@ -556,7 +555,7 @@ pub fn panicExtra(
556 break :blk &buf;555 break :blk &buf;
557 },556 },
558 };557 };
559 std.builtin.panic.call(msg, trace, ret_addr);558 std.builtin.panic.call(msg, ret_addr);
560}559}
561560
562/// Non-zero whenever the program triggered a panic.561/// Non-zero whenever the program triggered a panic.
...@@ -570,7 +569,6 @@ threadlocal var panic_stage: usize = 0;...@@ -570,7 +569,6 @@ threadlocal var panic_stage: usize = 0;
570/// Dumps a stack trace to standard error, then aborts.569/// Dumps a stack trace to standard error, then aborts.
571pub fn defaultPanic(570pub fn defaultPanic(
572 msg: []const u8,571 msg: []const u8,
573 error_return_trace: ?*const std.builtin.StackTrace,
574 first_trace_addr: ?usize,572 first_trace_addr: ?usize,
575) noreturn {573) noreturn {
576 @branchHint(.cold);574 @branchHint(.cold);
...@@ -657,7 +655,7 @@ pub fn defaultPanic(...@@ -657,7 +655,7 @@ pub fn defaultPanic(
657 }655 }
658 stderr.print("{s}\n", .{msg}) catch posix.abort();656 stderr.print("{s}\n", .{msg}) catch posix.abort();
659657
660 if (error_return_trace) |t| dumpStackTrace(t.*);658 if (@errorReturnTrace()) |t| dumpStackTrace(t.*);
661 dumpCurrentStackTrace(first_trace_addr orelse @returnAddress());659 dumpCurrentStackTrace(first_trace_addr orelse @returnAddress());
662 }660 }
663661
lib/std/debug/no_panic.zig+2-2
...@@ -5,7 +5,7 @@...@@ -5,7 +5,7 @@
55
6const std = @import("../std.zig");6const std = @import("../std.zig");
77
8pub fn call(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {8pub fn call(_: []const u8, _: ?usize) noreturn {
9 @branchHint(.cold);9 @branchHint(.cold);
10 @trap();10 @trap();
11}11}
...@@ -15,7 +15,7 @@ pub fn sentinelMismatch(_: anytype, _: anytype) noreturn {...@@ -15,7 +15,7 @@ pub fn sentinelMismatch(_: anytype, _: anytype) noreturn {
15 @trap();15 @trap();
16}16}
1717
18pub fn unwrapError(_: ?*std.builtin.StackTrace, _: anyerror) noreturn {18pub fn unwrapError(_: anyerror) noreturn {
19 @branchHint(.cold);19 @branchHint(.cold);
20 @trap();20 @trap();
21}21}
lib/std/debug/simple_panic.zig+27-29
...@@ -11,9 +11,8 @@ const std = @import("../std.zig");...@@ -11,9 +11,8 @@ const std = @import("../std.zig");
11/// Prints the message to stderr without a newline and then traps.11/// Prints the message to stderr without a newline and then traps.
12///12///
13/// Explicit calls to `@panic` lower to calling this function.13/// Explicit calls to `@panic` lower to calling this function.
14pub fn call(msg: []const u8, ert: ?*std.builtin.StackTrace, ra: ?usize) noreturn {14pub fn call(msg: []const u8, ra: ?usize) noreturn {
15 @branchHint(.cold);15 @branchHint(.cold);
16 _ = ert;
17 _ = ra;16 _ = ra;
18 std.debug.lockStdErr();17 std.debug.lockStdErr();
19 const stderr = std.io.getStdErr();18 const stderr = std.io.getStdErr();
...@@ -23,110 +22,109 @@ pub fn call(msg: []const u8, ert: ?*std.builtin.StackTrace, ra: ?usize) noreturn...@@ -23,110 +22,109 @@ pub fn call(msg: []const u8, ert: ?*std.builtin.StackTrace, ra: ?usize) noreturn
2322
24pub fn sentinelMismatch(expected: anytype, found: @TypeOf(expected)) noreturn {23pub fn sentinelMismatch(expected: anytype, found: @TypeOf(expected)) noreturn {
25 _ = found;24 _ = found;
26 call("sentinel mismatch", null, null);25 call("sentinel mismatch", null);
27}26}
2827
29pub fn unwrapError(ert: ?*std.builtin.StackTrace, err: anyerror) noreturn {28pub fn unwrapError(err: anyerror) noreturn {
30 _ = ert;
31 _ = &err;29 _ = &err;
32 call("attempt to unwrap error", null, null);30 call("attempt to unwrap error", null);
33}31}
3432
35pub fn outOfBounds(index: usize, len: usize) noreturn {33pub fn outOfBounds(index: usize, len: usize) noreturn {
36 _ = index;34 _ = index;
37 _ = len;35 _ = len;
38 call("index out of bounds", null, null);36 call("index out of bounds", null);
39}37}
4038
41pub fn startGreaterThanEnd(start: usize, end: usize) noreturn {39pub fn startGreaterThanEnd(start: usize, end: usize) noreturn {
42 _ = start;40 _ = start;
43 _ = end;41 _ = end;
44 call("start index is larger than end index", null, null);42 call("start index is larger than end index", null);
45}43}
4644
47pub fn inactiveUnionField(active: anytype, accessed: @TypeOf(active)) noreturn {45pub fn inactiveUnionField(active: anytype, accessed: @TypeOf(active)) noreturn {
48 _ = accessed;46 _ = accessed;
49 call("access of inactive union field", null, null);47 call("access of inactive union field", null);
50}48}
5149
52pub fn reachedUnreachable() noreturn {50pub fn reachedUnreachable() noreturn {
53 call("reached unreachable code", null, null);51 call("reached unreachable code", null);
54}52}
5553
56pub fn unwrapNull() noreturn {54pub fn unwrapNull() noreturn {
57 call("attempt to use null value", null, null);55 call("attempt to use null value", null);
58}56}
5957
60pub fn castToNull() noreturn {58pub fn castToNull() noreturn {
61 call("cast causes pointer to be null", null, null);59 call("cast causes pointer to be null", null);
62}60}
6361
64pub fn incorrectAlignment() noreturn {62pub fn incorrectAlignment() noreturn {
65 call("incorrect alignment", null, null);63 call("incorrect alignment", null);
66}64}
6765
68pub fn invalidErrorCode() noreturn {66pub fn invalidErrorCode() noreturn {
69 call("invalid error code", null, null);67 call("invalid error code", null);
70}68}
7169
72pub fn castTruncatedData() noreturn {70pub fn castTruncatedData() noreturn {
73 call("integer cast truncated bits", null, null);71 call("integer cast truncated bits", null);
74}72}
7573
76pub fn negativeToUnsigned() noreturn {74pub fn negativeToUnsigned() noreturn {
77 call("attempt to cast negative value to unsigned integer", null, null);75 call("attempt to cast negative value to unsigned integer", null);
78}76}
7977
80pub fn integerOverflow() noreturn {78pub fn integerOverflow() noreturn {
81 call("integer overflow", null, null);79 call("integer overflow", null);
82}80}
8381
84pub fn shlOverflow() noreturn {82pub fn shlOverflow() noreturn {
85 call("left shift overflowed bits", null, null);83 call("left shift overflowed bits", null);
86}84}
8785
88pub fn shrOverflow() noreturn {86pub fn shrOverflow() noreturn {
89 call("right shift overflowed bits", null, null);87 call("right shift overflowed bits", null);
90}88}
9189
92pub fn divideByZero() noreturn {90pub fn divideByZero() noreturn {
93 call("division by zero", null, null);91 call("division by zero", null);
94}92}
9593
96pub fn exactDivisionRemainder() noreturn {94pub fn exactDivisionRemainder() noreturn {
97 call("exact division produced remainder", null, null);95 call("exact division produced remainder", null);
98}96}
9997
100pub fn integerPartOutOfBounds() noreturn {98pub fn integerPartOutOfBounds() noreturn {
101 call("integer part of floating point value out of bounds", null, null);99 call("integer part of floating point value out of bounds", null);
102}100}
103101
104pub fn corruptSwitch() noreturn {102pub fn corruptSwitch() noreturn {
105 call("switch on corrupt value", null, null);103 call("switch on corrupt value", null);
106}104}
107105
108pub fn shiftRhsTooBig() noreturn {106pub fn shiftRhsTooBig() noreturn {
109 call("shift amount is greater than the type size", null, null);107 call("shift amount is greater than the type size", null);
110}108}
111109
112pub fn invalidEnumValue() noreturn {110pub fn invalidEnumValue() noreturn {
113 call("invalid enum value", null, null);111 call("invalid enum value", null);
114}112}
115113
116pub fn forLenMismatch() noreturn {114pub fn forLenMismatch() noreturn {
117 call("for loop over objects with non-equal lengths", null, null);115 call("for loop over objects with non-equal lengths", null);
118}116}
119117
120pub fn memcpyLenMismatch() noreturn {118pub fn memcpyLenMismatch() noreturn {
121 call("@memcpy arguments have non-equal lengths", null, null);119 call("@memcpy arguments have non-equal lengths", null);
122}120}
123121
124pub fn memcpyAlias() noreturn {122pub fn memcpyAlias() noreturn {
125 call("@memcpy arguments alias", null, null);123 call("@memcpy arguments alias", null);
126}124}
127125
128pub fn noreturnReturned() noreturn {126pub fn noreturnReturned() noreturn {
129 call("'noreturn' function returned", null, null);127 call("'noreturn' function returned", null);
130}128}
131129
132/// To be deleted after zig1.wasm update.130/// To be deleted after zig1.wasm update.
src/Sema.zig+1-1
...@@ -2584,7 +2584,7 @@ pub fn failWithOwnedErrorMsg(sema: *Sema, block: ?*Block, err_msg: *Zcu.ErrorMsg...@@ -2584,7 +2584,7 @@ pub fn failWithOwnedErrorMsg(sema: *Sema, block: ?*Block, err_msg: *Zcu.ErrorMsg
2584 std.debug.print("compile error during Sema:\n", .{});2584 std.debug.print("compile error during Sema:\n", .{});
2585 var error_bundle = wip_errors.toOwnedBundle("") catch @panic("out of memory");2585 var error_bundle = wip_errors.toOwnedBundle("") catch @panic("out of memory");
2586 error_bundle.renderToStdErr(.{ .ttyconf = .no_color });2586 error_bundle.renderToStdErr(.{ .ttyconf = .no_color });
2587 crash_report.compilerPanic("unexpected compile error occurred", null, null);2587 crash_report.compilerPanic("unexpected compile error occurred", null);
2588 }2588 }
25892589
2590 if (block) |start_block| {2590 if (block) |start_block| {
src/crash_report.zig+2-2
...@@ -158,12 +158,12 @@ fn writeFilePath(file: *Zcu.File, writer: anytype) !void {...@@ -158,12 +158,12 @@ fn writeFilePath(file: *Zcu.File, writer: anytype) !void {
158 try writer.writeAll(file.sub_file_path);158 try writer.writeAll(file.sub_file_path);
159}159}
160160
161pub fn compilerPanic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, maybe_ret_addr: ?usize) noreturn {161pub fn compilerPanic(msg: []const u8, maybe_ret_addr: ?usize) noreturn {
162 @branchHint(.cold);162 @branchHint(.cold);
163 PanicSwitch.preDispatch();163 PanicSwitch.preDispatch();
164 const ret_addr = maybe_ret_addr orelse @returnAddress();164 const ret_addr = maybe_ret_addr orelse @returnAddress();
165 const stack_ctx: StackContext = .{ .current = .{ .ret_addr = ret_addr } };165 const stack_ctx: StackContext = .{ .current = .{ .ret_addr = ret_addr } };
166 PanicSwitch.dispatch(error_return_trace, stack_ctx, msg);166 PanicSwitch.dispatch(@errorReturnTrace(), stack_ctx, msg);
167}167}
168168
169/// Attaches a global SIGSEGV handler169/// Attaches a global SIGSEGV handler
test/cases/compile_errors/bad_panic_call_signature.zig+4-5
...@@ -1,9 +1,8 @@...@@ -1,9 +1,8 @@
1const simple_panic = std.debug.simple_panic;1const simple_panic = std.debug.simple_panic;
2pub const panic = struct {2pub const panic = struct {
3 pub fn call(msg: []const u8, bad1: usize, bad2: void) noreturn {3 pub fn call(msg: []const u8, bad: usize) noreturn {
4 _ = msg;4 _ = msg;
5 _ = bad1;5 _ = bad;
6 _ = bad2;
7 @trap();6 @trap();
8 }7 }
9 pub const sentinelMismatch = simple_panic.sentinelMismatch;8 pub const sentinelMismatch = simple_panic.sentinelMismatch;
...@@ -42,5 +41,5 @@ const std = @import("std");...@@ -42,5 +41,5 @@ const std = @import("std");
4241
43// error42// error
44//43//
45// :3:9: error: expected type 'fn ([]const u8, ?*builtin.StackTrace, ?usize) noreturn', found 'fn ([]const u8, usize, void) noreturn'44// :3:9: error: expected type 'fn ([]const u8, ?usize) noreturn', found 'fn ([]const u8, usize) noreturn'
46// :3:9: note: parameter 1 'usize' cannot cast into '?*builtin.StackTrace'45// :3:9: note: parameter 1 'usize' cannot cast into '?usize'
test/incremental/change_panic_handler+3-3
...@@ -10,7 +10,7 @@ pub fn main() !u8 {...@@ -10,7 +10,7 @@ pub fn main() !u8 {
10 return 1;10 return 1;
11}11}
12pub const panic = std.debug.FullPanic(myPanic);12pub const panic = std.debug.FullPanic(myPanic);
13fn myPanic(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {13fn myPanic(msg: []const u8, _: ?usize) noreturn {
14 std.io.getStdOut().writer().print("panic message: {s}\n", .{msg}) catch {};14 std.io.getStdOut().writer().print("panic message: {s}\n", .{msg}) catch {};
15 std.process.exit(0);15 std.process.exit(0);
16}16}
...@@ -26,7 +26,7 @@ pub fn main() !u8 {...@@ -26,7 +26,7 @@ pub fn main() !u8 {
26 return 1;26 return 1;
27}27}
28pub const panic = std.debug.FullPanic(myPanic);28pub const panic = std.debug.FullPanic(myPanic);
29fn myPanic(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {29fn myPanic(msg: []const u8, _: ?usize) noreturn {
30 std.io.getStdOut().writer().print("new panic message: {s}\n", .{msg}) catch {};30 std.io.getStdOut().writer().print("new panic message: {s}\n", .{msg}) catch {};
31 std.process.exit(0);31 std.process.exit(0);
32}32}
...@@ -42,7 +42,7 @@ pub fn main() !u8 {...@@ -42,7 +42,7 @@ pub fn main() !u8 {
42 return 1;42 return 1;
43}43}
44pub const panic = std.debug.FullPanic(myPanicNew);44pub const panic = std.debug.FullPanic(myPanicNew);
45fn myPanicNew(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {45fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
46 std.io.getStdOut().writer().print("third panic message: {s}\n", .{msg}) catch {};46 std.io.getStdOut().writer().print("third panic message: {s}\n", .{msg}) catch {};
47 std.process.exit(0);47 std.process.exit(0);
48}48}
test/incremental/change_panic_handler_explicit+3-3
...@@ -40,7 +40,7 @@ pub const panic = struct {...@@ -40,7 +40,7 @@ pub const panic = struct {
40 pub const memcpyAlias = no_panic.memcpyAlias;40 pub const memcpyAlias = no_panic.memcpyAlias;
41 pub const noreturnReturned = no_panic.noreturnReturned;41 pub const noreturnReturned = no_panic.noreturnReturned;
42};42};
43fn myPanic(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {43fn myPanic(msg: []const u8, _: ?usize) noreturn {
44 std.io.getStdOut().writer().print("panic message: {s}\n", .{msg}) catch {};44 std.io.getStdOut().writer().print("panic message: {s}\n", .{msg}) catch {};
45 std.process.exit(0);45 std.process.exit(0);
46}46}
...@@ -86,7 +86,7 @@ pub const panic = struct {...@@ -86,7 +86,7 @@ pub const panic = struct {
86 pub const memcpyAlias = no_panic.memcpyAlias;86 pub const memcpyAlias = no_panic.memcpyAlias;
87 pub const noreturnReturned = no_panic.noreturnReturned;87 pub const noreturnReturned = no_panic.noreturnReturned;
88};88};
89fn myPanic(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {89fn myPanic(msg: []const u8, _: ?usize) noreturn {
90 std.io.getStdOut().writer().print("new panic message: {s}\n", .{msg}) catch {};90 std.io.getStdOut().writer().print("new panic message: {s}\n", .{msg}) catch {};
91 std.process.exit(0);91 std.process.exit(0);
92}92}
...@@ -133,7 +133,7 @@ pub const panic = struct {...@@ -133,7 +133,7 @@ pub const panic = struct {
133 pub const memcpyAlias = no_panic.memcpyAlias;133 pub const memcpyAlias = no_panic.memcpyAlias;
134 pub const noreturnReturned = no_panic.noreturnReturned;134 pub const noreturnReturned = no_panic.noreturnReturned;
135};135};
136fn myPanicNew(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {136fn myPanicNew(msg: []const u8, _: ?usize) noreturn {
137 std.io.getStdOut().writer().print("third panic message: {s}\n", .{msg}) catch {};137 std.io.getStdOut().writer().print("third panic message: {s}\n", .{msg}) catch {};
138 std.process.exit(0);138 std.process.exit(0);
139}139}
test/src/Cases.zig-1
...@@ -358,7 +358,6 @@ pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void {...@@ -358,7 +358,6 @@ pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir, b: *std.Build) void {
358 var current_file: []const u8 = "none";358 var current_file: []const u8 = "none";
359 ctx.addFromDirInner(dir, &current_file, b) catch |err| {359 ctx.addFromDirInner(dir, &current_file, b) catch |err| {
360 std.debug.panicExtra(360 std.debug.panicExtra(
361 @errorReturnTrace(),
362 @returnAddress(),361 @returnAddress(),
363 "test harness failed to process file '{s}': {s}\n",362 "test harness failed to process file '{s}': {s}\n",
364 .{ current_file, @errorName(err) },363 .{ current_file, @errorName(err) },