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