authorgravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-08 13:49:44-07:00
committergravatar for mason@gamesbymason.comMason Remaley <mason@gamesbymason.com> 2026-04-12 04:01:29-07:00
log94ff38af87e9784fc78ad3186553c953860659c4
tree603ab10f0ca97fe8827029ee870f2f144799243c
parentcc15c8ae7e0b8d994e818f8275bf73617edefe68

Separates error return traces from stack traces

Doesn't commit the changes to stage1, we can generate those at the end once we're not making any more changes to it to avoid wasting storage.

123 files changed, 190 insertions(+), 175 deletions(-)

doc/langref.html.in+1-1
...@@ -4900,7 +4900,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val...@@ -4900,7 +4900,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
4900 {#header_close#}4900 {#header_close#}
49014901
4902 {#header_open|@errorReturnTrace#}4902 {#header_open|@errorReturnTrace#}
4903 <pre>{#syntax#}@errorReturnTrace() ?*builtin.StackTrace{#endsyntax#}</pre>4903 <pre>{#syntax#}@errorReturnTrace() ?*builtin.ErrorReturnTrace{#endsyntax#}</pre>
4904 <p>4904 <p>
4905 If the binary is built with error return tracing, and this function is invoked in a4905 If the binary is built with error return tracing, and this function is invoked in a
4906 function that calls a function with an error or error union return type, returns a4906 function that calls a function with an error or error union return type, returns a
lib/build-web/main.zig+1-1
...@@ -40,7 +40,7 @@ pub const std_options: std.Options = .{...@@ -40,7 +40,7 @@ pub const std_options: std.Options = .{
40 .logFn = logFn,40 .logFn = logFn,
41};41};
4242
43pub fn panic(msg: []const u8, st: ?*std.builtin.StackTrace, addr: ?usize) noreturn {43pub fn panic(msg: []const u8, st: ?*std.debug.StackTrace, addr: ?usize) noreturn {
44 _ = st;44 _ = st;
45 _ = addr;45 _ = addr;
46 log.err("panic: {s}", .{msg});46 log.err("panic: {s}", .{msg});
lib/docs/wasm/main.zig+1-1
...@@ -33,7 +33,7 @@ pub const std_options: std.Options = .{...@@ -33,7 +33,7 @@ pub const std_options: std.Options = .{
33 //.log_level = .debug,33 //.log_level = .debug,
34};34};
3535
36pub fn panic(msg: []const u8, st: ?*std.builtin.StackTrace, addr: ?usize) noreturn {36pub fn panic(msg: []const u8, st: ?*std.debug.StackTrace, addr: ?usize) noreturn {
37 _ = st;37 _ = st;
38 _ = addr;38 _ = addr;
39 log.err("panic: {s}", .{msg});39 log.err("panic: {s}", .{msg});
lib/std/Build/Step.zig+1-1
...@@ -67,7 +67,7 @@ test_results: TestResults,...@@ -67,7 +67,7 @@ test_results: TestResults,
6767
68/// The return address associated with creation of this step that can be useful68/// The return address associated with creation of this step that can be useful
69/// to print along with debugging messages.69/// to print along with debugging messages.
70debug_stack_trace: std.builtin.StackTrace,70debug_stack_trace: std.debug.StackTrace,
7171
72pub const TestResults = struct {72pub const TestResults = struct {
73 /// The total number of tests in the step. Every test has a "status" from the following:73 /// The total number of tests in the step. Every test has a "status" from the following:
lib/std/builtin.zig+1-4
...@@ -8,12 +8,9 @@ pub const assembly = @import("builtin/assembly.zig");...@@ -8,12 +8,9 @@ pub const assembly = @import("builtin/assembly.zig");
88
9/// This data structure is used by the Zig language code generation and9/// This data structure is used by the Zig language code generation and
10/// therefore must be kept in sync with the compiler implementation.10/// therefore must be kept in sync with the compiler implementation.
11pub const StackTrace = struct {11pub const ErrorReturnTrace = struct {
12 index: usize,12 index: usize,
13 instruction_addresses: []usize,13 instruction_addresses: []usize,
14 /// Set to true if inlined frames are given their own entries in `instruction_addresses`,
15 /// otherwise set to false.
16 includes_inlined_frames: bool,
17};14};
1815
19/// This data structure is used by the Zig language code generation and16/// This data structure is used by the Zig language code generation and
lib/std/debug.zig+36-15
...@@ -13,7 +13,6 @@ const windows = std.os.windows;...@@ -13,7 +13,6 @@ const windows = std.os.windows;
13const builtin = @import("builtin");13const builtin = @import("builtin");
14const native_arch = builtin.cpu.arch;14const native_arch = builtin.cpu.arch;
15const native_os = builtin.os.tag;15const native_os = builtin.os.tag;
16const StackTrace = std.builtin.StackTrace;
1716
18const root = @import("root");17const root = @import("root");
1918
...@@ -568,7 +567,7 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn {...@@ -568,7 +567,7 @@ pub fn defaultPanic(msg: []const u8, first_trace_addr: ?usize) noreturn {
568567
569 if (@errorReturnTrace()) |t| if (t.index > 0) {568 if (@errorReturnTrace()) |t| if (t.index > 0) {
570 writer.writeAll("error return context:\n") catch break :trace;569 writer.writeAll("error return context:\n") catch break :trace;
571 writeStackTrace(t, stderr) catch break :trace;570 writeErrorReturnTrace(t, stderr) catch break :trace;
572 writer.writeAll("\nstack trace:\n") catch break :trace;571 writer.writeAll("\nstack trace:\n") catch break :trace;
573 };572 };
574 writeCurrentStackTrace(.{573 writeCurrentStackTrace(.{
...@@ -607,6 +606,13 @@ fn waitForOtherThreadToFinishPanicking() void {...@@ -607,6 +606,13 @@ fn waitForOtherThreadToFinishPanicking() void {
607 }606 }
608}607}
609608
609/// This data structure is used by the Zig language code generation and
610/// therefore must be kept in sync with the compiler implementation.
611pub const StackTrace = struct {
612 index: usize,
613 instruction_addresses: []usize,
614};
615
610pub const StackUnwindOptions = struct {616pub const StackUnwindOptions = struct {
611 /// If not `null`, we will ignore all frames up until this return address. This is typically617 /// If not `null`, we will ignore all frames up until this return address. This is typically
612 /// used to omit intermediate handling code (for instance, a panic handler and its machinery)618 /// used to omit intermediate handling code (for instance, a panic handler and its machinery)
...@@ -629,7 +635,6 @@ pub noinline fn captureCurrentStackTrace(options: StackUnwindOptions, addr_buf:...@@ -629,7 +635,6 @@ pub noinline fn captureCurrentStackTrace(options: StackUnwindOptions, addr_buf:
629 const empty_trace: StackTrace = .{635 const empty_trace: StackTrace = .{
630 .index = 0,636 .index = 0,
631 .instruction_addresses = &.{},637 .instruction_addresses = &.{},
632 .includes_inlined_frames = false,
633 };638 };
634 if (!std.options.allow_stack_tracing) return empty_trace;639 if (!std.options.allow_stack_tracing) return empty_trace;
635 var it: StackIterator = .init(options.context);640 var it: StackIterator = .init(options.context);
...@@ -665,7 +670,6 @@ pub noinline fn captureCurrentStackTrace(options: StackUnwindOptions, addr_buf:...@@ -665,7 +670,6 @@ pub noinline fn captureCurrentStackTrace(options: StackUnwindOptions, addr_buf:
665 return .{670 return .{
666 .index = index,671 .index = index,
667 .instruction_addresses = addr_buf[0..index],672 .instruction_addresses = addr_buf[0..index],
668 .includes_inlined_frames = false,
669 };673 };
670}674}
671/// Write the current stack trace to `writer`, annotated with source locations.675/// Write the current stack trace to `writer`, annotated with source locations.
...@@ -752,7 +756,7 @@ pub noinline fn writeCurrentStackTrace(options: StackUnwindOptions, t: Io.Termin...@@ -752,7 +756,7 @@ pub noinline fn writeCurrentStackTrace(options: StackUnwindOptions, t: Io.Termin
752 // Subtract 1 to get an address *in* the function call for a better source location.756 // Subtract 1 to get an address *in* the function call for a better source location.
753 try printSourceAtAddress(io, di, t, .{757 try printSourceAtAddress(io, di, t, .{
754 .address = ret_addr -| StackIterator.ra_call_offset,758 .address = ret_addr -| StackIterator.ra_call_offset,
755 .print_inlines = true,759 .resolve_inline_callers = true,
756 });760 });
757 printed_any_frame = true;761 printed_any_frame = true;
758 },762 },
...@@ -786,8 +790,17 @@ pub const FormatStackTrace = struct {...@@ -786,8 +790,17 @@ pub const FormatStackTrace = struct {
786 }790 }
787};791};
788792
793/// Write a previously captured error return trace to `writer`, annotated with source locations.
794pub fn writeErrorReturnTrace(st: *const std.builtin.ErrorReturnTrace, t: Io.Terminal) Writer.Error!void {
795 try writeTrace(st, t, false);
796}
797
789/// Write a previously captured stack trace to `writer`, annotated with source locations.798/// Write a previously captured stack trace to `writer`, annotated with source locations.
790pub fn writeStackTrace(st: *const StackTrace, t: Io.Terminal) Writer.Error!void {799pub fn writeStackTrace(et: *const StackTrace, t: Io.Terminal) Writer.Error!void {
800 try writeTrace(et, t, true);
801}
802
803fn writeTrace(trace: anytype, t: Io.Terminal, resolve_inline_callers: bool) Writer.Error!void {
791 const writer = t.writer;804 const writer = t.writer;
792 if (!std.options.allow_stack_tracing) {805 if (!std.options.allow_stack_tracing) {
793 t.setColor(.dim) catch {};806 t.setColor(.dim) catch {};
...@@ -796,9 +809,9 @@ pub fn writeStackTrace(st: *const StackTrace, t: Io.Terminal) Writer.Error!void...@@ -796,9 +809,9 @@ pub fn writeStackTrace(st: *const StackTrace, t: Io.Terminal) Writer.Error!void
796 return;809 return;
797 }810 }
798811
799 // Fetch `st.index` straight away. Aside from avoiding redundant loads, this prevents issues if812 // Fetch `trace.index` straight away. Aside from avoiding redundant loads, this prevents issues if
800 // `st` is `@errorReturnTrace()` and errors are encountered while writing the stack trace.813 // `trace` is `@errorReturnTrace()` and errors are encountered while writing the stack trace.
801 const n_frames = st.index;814 const n_frames = trace.index;
802 if (n_frames == 0) return writer.writeAll("(empty stack trace)\n");815 if (n_frames == 0) return writer.writeAll("(empty stack trace)\n");
803 const di = getSelfDebugInfo() catch |err| switch (err) {816 const di = getSelfDebugInfo() catch |err| switch (err) {
804 error.UnsupportedTarget => {817 error.UnsupportedTarget => {
...@@ -809,13 +822,13 @@ pub fn writeStackTrace(st: *const StackTrace, t: Io.Terminal) Writer.Error!void...@@ -809,13 +822,13 @@ pub fn writeStackTrace(st: *const StackTrace, t: Io.Terminal) Writer.Error!void
809 },822 },
810 };823 };
811 const io = std.Options.debug_io;824 const io = std.Options.debug_io;
812 const captured_frames = @min(n_frames, st.instruction_addresses.len);825 const captured_frames = @min(n_frames, trace.instruction_addresses.len);
813 for (st.instruction_addresses[0..captured_frames]) |ret_addr| {826 for (trace.instruction_addresses[0..captured_frames]) |ret_addr| {
814 // `ret_addr` is the return address, which is *after* the function call.827 // `ret_addr` is the return address, which is *after* the function call.
815 // Subtract 1 to get an address *in* the function call for a better source location.828 // Subtract 1 to get an address *in* the function call for a better source location.
816 try printSourceAtAddress(io, di, t, .{829 try printSourceAtAddress(io, di, t, .{
817 .address = ret_addr -| StackIterator.ra_call_offset,830 .address = ret_addr -| StackIterator.ra_call_offset,
818 .print_inlines = !st.includes_inlined_frames,831 .resolve_inline_callers = resolve_inline_callers,
819 });832 });
820 }833 }
821 if (n_frames > captured_frames) {834 if (n_frames > captured_frames) {
...@@ -833,6 +846,15 @@ pub fn dumpStackTrace(st: *const StackTrace) void {...@@ -833,6 +846,15 @@ pub fn dumpStackTrace(st: *const StackTrace) void {
833 };846 };
834}847}
835848
849/// A thin wrapper around `writeErrorReturnTrace` which writes to stderr and ignores write errors.
850pub fn dumpErrorReturnTrace(et: *const std.builtin.ErrorReturnTrace) void {
851 const stderr = lockStderr(&.{}).terminal();
852 defer unlockStderr();
853 writeErrorReturnTrace(et, stderr) catch |err| switch (err) {
854 error.WriteFailed => {},
855 };
856}
857
836const StackIterator = union(enum) {858const StackIterator = union(enum) {
837 /// We will first report the current PC of this `CpuContextPtr`, then we will switch to a859 /// We will first report the current PC of this `CpuContextPtr`, then we will switch to a
838 /// different strategy to actually unwind.860 /// different strategy to actually unwind.
...@@ -1124,7 +1146,7 @@ pub inline fn stripInstructionPtrAuthCode(ptr: usize) usize {...@@ -1124,7 +1146,7 @@ pub inline fn stripInstructionPtrAuthCode(ptr: usize) usize {
11241146
1125const PrintSourceAddressOptions = struct {1147const PrintSourceAddressOptions = struct {
1126 address: usize,1148 address: usize,
1127 print_inlines: bool,1149 resolve_inline_callers: bool,
1128};1150};
11291151
1130fn printSourceAtAddress(1152fn printSourceAtAddress(
...@@ -1163,7 +1185,7 @@ fn printSourceAtAddress(...@@ -1163,7 +1185,7 @@ fn printSourceAtAddress(
1163 symbol.name orelse "???",1185 symbol.name orelse "???",
1164 symbol.compile_unit_name orelse debug_info.getModuleName(io, options.address) catch "???",1186 symbol.compile_unit_name orelse debug_info.getModuleName(io, options.address) catch "???",
1165 );1187 );
1166 if (!options.print_inlines) break;1188 if (!options.resolve_inline_callers) break;
1167 }1189 }
1168}1190}
1169fn printLineInfo(1191fn printLineInfo(
...@@ -1708,7 +1730,6 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize...@@ -1708,7 +1730,6 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize
1708 const stack_trace: StackTrace = .{1730 const stack_trace: StackTrace = .{
1709 .index = frames.len,1731 .index = frames.len,
1710 .instruction_addresses = frames,1732 .instruction_addresses = frames,
1711 .includes_inlined_frames = false,
1712 };1733 };
1713 writeStackTrace(&stack_trace, stderr) catch return;1734 writeStackTrace(&stack_trace, stderr) catch return;
1714 }1735 }
lib/std/heap/debug_allocator.zig+2-4
...@@ -81,7 +81,7 @@...@@ -81,7 +81,7 @@
81//! Resizing and remapping are forwarded directly to the backing allocator,81//! Resizing and remapping are forwarded directly to the backing allocator,
82//! except where such operations would change the category from large to small.82//! except where such operations would change the category from large to small.
83const builtin = @import("builtin");83const builtin = @import("builtin");
84const StackTrace = std.builtin.StackTrace;84const StackTrace = std.debug.StackTrace;
8585
86const std = @import("std");86const std = @import("std");
87const log = std.log.scoped(.DebugAllocator);87const log = std.log.scoped(.DebugAllocator);
...@@ -229,7 +229,7 @@ pub fn DebugAllocator(comptime config: Config) type {...@@ -229,7 +229,7 @@ pub fn DebugAllocator(comptime config: Config) type {
229 std.debug.dumpStackTrace(self.getStackTrace(trace_kind));229 std.debug.dumpStackTrace(self.getStackTrace(trace_kind));
230 }230 }
231231
232 fn getStackTrace(self: *LargeAlloc, trace_kind: TraceKind) std.builtin.StackTrace {232 fn getStackTrace(self: *LargeAlloc, trace_kind: TraceKind) std.debug.StackTrace {
233 assert(@intFromEnum(trace_kind) < trace_n);233 assert(@intFromEnum(trace_kind) < trace_n);
234 const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)];234 const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)];
235 var len: usize = 0;235 var len: usize = 0;
...@@ -239,7 +239,6 @@ pub fn DebugAllocator(comptime config: Config) type {...@@ -239,7 +239,6 @@ pub fn DebugAllocator(comptime config: Config) type {
239 return .{239 return .{
240 .instruction_addresses = stack_addresses,240 .instruction_addresses = stack_addresses,
241 .index = len,241 .index = len,
242 .includes_inlined_frames = false,
243 };242 };
244 }243 }
245244
...@@ -342,7 +341,6 @@ pub fn DebugAllocator(comptime config: Config) type {...@@ -342,7 +341,6 @@ pub fn DebugAllocator(comptime config: Config) type {
342 return .{341 return .{
343 .instruction_addresses = stack_addresses,342 .instruction_addresses = stack_addresses,
344 .index = len,343 .index = len,
345 .includes_inlined_frames = false,
346 };344 };
347 }345 }
348346
lib/std/start.zig+1-1
...@@ -761,7 +761,7 @@ inline fn wrapMain(result: anytype) u8 {...@@ -761,7 +761,7 @@ inline fn wrapMain(result: anytype) u8 {
761 std.log.err("{t}", .{err});761 std.log.err("{t}", .{err});
762 switch (native_os) {762 switch (native_os) {
763 .freestanding, .other => {},763 .freestanding, .other => {},
764 else => if (@errorReturnTrace()) |trace| std.debug.dumpStackTrace(trace),764 else => if (@errorReturnTrace()) |trace| std.debug.dumpErrorReturnTrace(trace),
765 }765 }
766 return 1;766 return 1;
767 };767 };
lib/std/testing/FailingAllocator.zig+1-1
...@@ -131,7 +131,7 @@ fn free(...@@ -131,7 +131,7 @@ fn free(
131}131}
132132
133/// Only valid once `has_induced_failure == true`133/// Only valid once `has_induced_failure == true`
134pub fn getStackTrace(self: *FailingAllocator) std.builtin.StackTrace {134pub fn getStackTrace(self: *FailingAllocator) std.debug.StackTrace {
135 std.debug.assert(self.has_induced_failure);135 std.debug.assert(self.has_induced_failure);
136 var len: usize = 0;136 var len: usize = 0;
137 while (len < self.stack_addresses.len and self.stack_addresses[len] != 0) {137 while (len < self.stack_addresses.len and self.stack_addresses[len] != 0) {
src/Sema.zig+22-23
...@@ -2252,9 +2252,8 @@ pub fn setupErrorReturnTrace(sema: *Sema, block: *Block, last_arg_index: usize)...@@ -2252,9 +2252,8 @@ pub fn setupErrorReturnTrace(sema: *Sema, block: *Block, last_arg_index: usize)
2252 });2252 });
2253 const addrs_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(addr_arr_ty));2253 const addrs_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(addr_arr_ty));
22542254
2255 // var st: StackTrace = undefined;2255 const error_return_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .ErrorReturnTrace);
2256 const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace);2256 const st_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(error_return_trace_ty));
2257 const st_ptr = try err_trace_block.addTy(.alloc, try pt.singleMutPtrType(stack_trace_ty));
22582257
2259 // st.instruction_addresses = &addrs;2258 // st.instruction_addresses = &addrs;
2260 const instruction_addresses_field_name = try ip.getOrPutString(gpa, io, pt.tid, "instruction_addresses", .no_embedded_nulls);2259 const instruction_addresses_field_name = try ip.getOrPutString(gpa, io, pt.tid, "instruction_addresses", .no_embedded_nulls);
...@@ -6166,10 +6165,10 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref...@@ -6166,10 +6165,10 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref
61666165
6167 if (!block.ownerModule().error_tracing) return .none;6166 if (!block.ownerModule().error_tracing) return .none;
61686167
6169 const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace);6168 const error_return_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .ErrorReturnTrace);
6170 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);6169 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);
6171 const field_index = sema.structFieldIndex(block, stack_trace_ty, field_name, LazySrcLoc.unneeded) catch |err| switch (err) {6170 const field_index = sema.structFieldIndex(block, error_return_trace_ty, field_name, LazySrcLoc.unneeded) catch |err| switch (err) {
6172 error.AnalysisFail => @panic("std.builtin.StackTrace is corrupt"),6171 error.AnalysisFail => @panic("std.builtin.ErrorReturnTrace is corrupt"),
6173 error.ComptimeReturn, error.ComptimeBreak => unreachable,6172 error.ComptimeReturn, error.ComptimeBreak => unreachable,
6174 error.OutOfMemory, error.Canceled => |e| return e,6173 error.OutOfMemory, error.Canceled => |e| return e,
6175 };6174 };
...@@ -6177,7 +6176,7 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref...@@ -6177,7 +6176,7 @@ pub fn analyzeSaveErrRetIndex(sema: *Sema, block: *Block) SemaError!Air.Inst.Ref
6177 return try block.addInst(.{6176 return try block.addInst(.{
6178 .tag = .save_err_return_trace_index,6177 .tag = .save_err_return_trace_index,
6179 .data = .{ .ty_pl = .{6178 .data = .{ .ty_pl = .{
6180 .ty = Air.internedToRef(stack_trace_ty.toIntern()),6179 .ty = Air.internedToRef(error_return_trace_ty.toIntern()),
6181 .payload = @intCast(field_index),6180 .payload = @intCast(field_index),
6182 } },6181 } },
6183 });6182 });
...@@ -6209,11 +6208,11 @@ fn popErrorReturnTrace(...@@ -6209,11 +6208,11 @@ fn popErrorReturnTrace(
6209 // AstGen determined this result does not go to an error-handling expr (try/catch/return etc.), or6208 // AstGen determined this result does not go to an error-handling expr (try/catch/return etc.), or
6210 // the result is comptime-known to be a non-error. Either way, pop unconditionally.6209 // the result is comptime-known to be a non-error. Either way, pop unconditionally.
62116210
6212 const stack_trace_ty = try sema.getBuiltinType(src, .StackTrace);6211 const error_return_trace_ty = try sema.getBuiltinType(src, .ErrorReturnTrace);
6213 const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty);6212 const ptr_error_return_trace_ty = try pt.singleMutPtrType(error_return_trace_ty);
6214 const err_return_trace = try block.addTy(.err_return_trace, ptr_stack_trace_ty);6213 const err_return_trace = try block.addTy(.err_return_trace, ptr_error_return_trace_ty);
6215 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);6214 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);
6216 const field_ptr = try sema.structFieldPtr(block, src, err_return_trace, field_name, src, stack_trace_ty);6215 const field_ptr = try sema.structFieldPtr(block, src, err_return_trace, field_name, src, error_return_trace_ty);
6217 try sema.storePtr2(block, src, field_ptr, src, saved_error_trace_index, src, .store);6216 try sema.storePtr2(block, src, field_ptr, src, saved_error_trace_index, src, .store);
6218 } else if (is_non_error == null) {6217 } else if (is_non_error == null) {
6219 // The result might be an error. If it is, we leave the error trace alone. If it isn't, we need6218 // The result might be an error. If it is, we leave the error trace alone. If it isn't, we need
...@@ -6234,11 +6233,11 @@ fn popErrorReturnTrace(...@@ -6234,11 +6233,11 @@ fn popErrorReturnTrace(
6234 defer then_block.instructions.deinit(gpa);6233 defer then_block.instructions.deinit(gpa);
62356234
6236 // If non-error, then pop the error return trace by restoring the index.6235 // If non-error, then pop the error return trace by restoring the index.
6237 const stack_trace_ty = try sema.getBuiltinType(src, .StackTrace);6236 const error_return_trace_ty = try sema.getBuiltinType(src, .ErrorReturnTrace);
6238 const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty);6237 const ptr_error_return_trace_ty = try pt.singleMutPtrType(error_return_trace_ty);
6239 const err_return_trace = try then_block.addTy(.err_return_trace, ptr_stack_trace_ty);6238 const err_return_trace = try then_block.addTy(.err_return_trace, ptr_error_return_trace_ty);
6240 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);6239 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);
6241 const field_ptr = try sema.structFieldPtr(&then_block, src, err_return_trace, field_name, src, stack_trace_ty);6240 const field_ptr = try sema.structFieldPtr(&then_block, src, err_return_trace, field_name, src, error_return_trace_ty);
6242 try sema.storePtr2(&then_block, src, field_ptr, src, saved_error_trace_index, src, .store);6241 try sema.storePtr2(&then_block, src, field_ptr, src, saved_error_trace_index, src, .store);
6243 _ = try then_block.addBr(cond_block_inst, .void_value);6242 _ = try then_block.addBr(cond_block_inst, .void_value);
62446243
...@@ -6373,15 +6372,15 @@ fn zirCall(...@@ -6373,15 +6372,15 @@ fn zirCall(
6373 // If any input is an error-type, we might need to pop any trace it generated. Otherwise, we only6372 // If any input is an error-type, we might need to pop any trace it generated. Otherwise, we only
6374 // need to clean-up our own trace if we were passed to a non-error-handling expression.6373 // need to clean-up our own trace if we were passed to a non-error-handling expression.
6375 if (input_is_error or (pop_error_return_trace and return_ty.isError(zcu))) {6374 if (input_is_error or (pop_error_return_trace and return_ty.isError(zcu))) {
6376 const stack_trace_ty = try sema.getBuiltinType(call_src, .StackTrace);6375 const error_return_trace_ty = try sema.getBuiltinType(call_src, .ErrorReturnTrace);
6377 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);6376 const field_name = try zcu.intern_pool.getOrPutString(gpa, io, pt.tid, "index", .no_embedded_nulls);
6378 const field_index = try sema.structFieldIndex(block, stack_trace_ty, field_name, call_src);6377 const field_index = try sema.structFieldIndex(block, error_return_trace_ty, field_name, call_src);
63796378
6380 // Insert a save instruction before the arg resolution + call instructions we just generated6379 // Insert a save instruction before the arg resolution + call instructions we just generated
6381 const save_inst = try block.insertInst(block_index, .{6380 const save_inst = try block.insertInst(block_index, .{
6382 .tag = .save_err_return_trace_index,6381 .tag = .save_err_return_trace_index,
6383 .data = .{ .ty_pl = .{6382 .data = .{ .ty_pl = .{
6384 .ty = Air.internedToRef(stack_trace_ty.toIntern()),6383 .ty = Air.internedToRef(error_return_trace_ty.toIntern()),
6385 .payload = @intCast(field_index),6384 .payload = @intCast(field_index),
6386 } },6385 } },
6387 });6386 });
...@@ -19529,13 +19528,13 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref {...@@ -19529,13 +19528,13 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref {
19529 const pt = sema.pt;19528 const pt = sema.pt;
19530 const zcu = pt.zcu;19529 const zcu = pt.zcu;
19531 const ip = &zcu.intern_pool;19530 const ip = &zcu.intern_pool;
19532 const stack_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .StackTrace);19531 const error_return_trace_ty = try sema.getBuiltinType(block.nodeOffset(.zero), .ErrorReturnTrace);
19533 const ptr_stack_trace_ty = try pt.singleMutPtrType(stack_trace_ty);19532 const ptr_error_return_trace_ty = try pt.singleMutPtrType(error_return_trace_ty);
19534 const opt_ptr_stack_trace_ty = try pt.optionalType(ptr_stack_trace_ty.toIntern());19533 const opt_ptr_error_return_trace_ty = try pt.optionalType(ptr_error_return_trace_ty.toIntern());
1953519534
19536 switch (sema.owner.unwrap()) {19535 switch (sema.owner.unwrap()) {
19537 .func => |func| if (ip.funcAnalysisUnordered(func).has_error_trace and block.ownerModule().error_tracing) {19536 .func => |func| if (ip.funcAnalysisUnordered(func).has_error_trace and block.ownerModule().error_tracing) {
19538 return block.addTy(.err_return_trace, opt_ptr_stack_trace_ty);19537 return block.addTy(.err_return_trace, opt_ptr_error_return_trace_ty);
19539 },19538 },
1954019539
19541 .@"comptime",19540 .@"comptime",
...@@ -19547,7 +19546,7 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref {...@@ -19547,7 +19546,7 @@ fn getErrorReturnTrace(sema: *Sema, block: *Block) CompileError!Air.Inst.Ref {
19547 => {},19546 => {},
19548 }19547 }
19549 return Air.internedToRef(try pt.intern(.{ .opt = .{19548 return Air.internedToRef(try pt.intern(.{ .opt = .{
19550 .ty = opt_ptr_stack_trace_ty.toIntern(),19549 .ty = opt_ptr_error_return_trace_ty.toIntern(),
19551 .val = .none,19550 .val = .none,
19552 } }));19551 } }));
19553}19552}
src/Zcu.zig+2-2
...@@ -434,7 +434,7 @@ pub const BuiltinDecl = enum {...@@ -434,7 +434,7 @@ pub const BuiltinDecl = enum {
434 AddressSpace,434 AddressSpace,
435 CallingConvention,435 CallingConvention,
436 returnError,436 returnError,
437 StackTrace,437 ErrorReturnTrace,
438 SourceLocation,438 SourceLocation,
439 CallModifier,439 CallModifier,
440 AtomicOrder,440 AtomicOrder,
...@@ -512,7 +512,7 @@ pub const BuiltinDecl = enum {...@@ -512,7 +512,7 @@ pub const BuiltinDecl = enum {
512 return switch (decl) {512 return switch (decl) {
513 .returnError => .func,513 .returnError => .func,
514514
515 .StackTrace,515 .ErrorReturnTrace,
516 .CallingConvention,516 .CallingConvention,
517 .SourceLocation,517 .SourceLocation,
518 .Signedness,518 .Signedness,
src/codegen/llvm.zig+1-1
...@@ -3374,7 +3374,7 @@ pub const Object = struct {...@@ -3374,7 +3374,7 @@ pub const Object = struct {
3374 }3374 }
33753375
3376 if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) {3376 if (fn_info.cc == .auto and zcu.comp.config.any_error_tracing) {
3377 // First parameter is a pointer to `std.builtin.StackTrace`.3377 // First parameter is a pointer to `std.builtin.ErrorReturnTrace`.
3378 const llvm_ptr_ty = try o.builder.ptrType(toLlvmAddressSpace(.generic, target));3378 const llvm_ptr_ty = try o.builder.ptrType(toLlvmAddressSpace(.generic, target));
3379 try llvm_params.append(o.gpa, llvm_ptr_ty);3379 try llvm_params.append(o.gpa, llvm_ptr_ty);
3380 }3380 }
test/cases/compile_errors/panic_has_source_location.zig+1-1
...@@ -6,7 +6,7 @@ export fn foo() void {...@@ -6,7 +6,7 @@ export fn foo() void {
6 @panic("oh no");6 @panic("oh no");
7}7}
88
9pub fn panic(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {9pub fn panic(_: []const u8, _: ?*std.debug.StackTrace, _: ?usize) noreturn {
10 @compileError("panic");10 @compileError("panic");
11}11}
1212
test/cases/disable_stack_tracing.zig+1-1
...@@ -13,7 +13,7 @@ pub fn main() !void {...@@ -13,7 +13,7 @@ pub fn main() !void {
1313
14 try stdout.interface.flush();14 try stdout.interface.flush();
15}15}
16fn foo(w: *std.Io.Writer, st_buf: []usize) !std.builtin.StackTrace {16fn foo(w: *std.Io.Writer, st_buf: []usize) !std.debug.StackTrace {
17 try std.debug.writeCurrentStackTrace(.{}, .{ .writer = w, .mode = .no_color });17 try std.debug.writeCurrentStackTrace(.{}, .{ .writer = w, .mode = .no_color });
18 return std.debug.captureCurrentStackTrace(.{}, st_buf);18 return std.debug.captureCurrentStackTrace(.{}, st_buf);
19}19}
test/cases/safety/@alignCast misaligned.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "incorrect alignment")) {5 if (std.mem.eql(u8, message, "incorrect alignment")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@enumFromInt - no matching tag value.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "invalid enum value")) {5 if (std.mem.eql(u8, message, "invalid enum value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@enumFromInt truncated bits - exhaustive.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, _: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 if (std.mem.eql(u8, message, "invalid enum value")) {4 if (std.mem.eql(u8, message, "invalid enum value")) {
5 std.process.exit(0);5 std.process.exit(0);
6 }6 }
test/cases/safety/@enumFromInt truncated bits - nonexhaustive.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, _: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 if (std.mem.eql(u8, message, "invalid enum value")) {4 if (std.mem.eql(u8, message, "invalid enum value")) {
5 std.process.exit(0);5 std.process.exit(0);
6 }6 }
test/cases/safety/@errorCast error not present in destination.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "invalid error code")) {5 if (std.mem.eql(u8, message, "invalid error code")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@errorCast error union casted to disjoint set.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "invalid error code")) {5 if (std.mem.eql(u8, message, "invalid error code")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@intCast to u0.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - i0 max.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - i0 min.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - signed max.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - signed min.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - u0 max.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - u0 min.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - unsigned max.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - unsigned min.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - vector max.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - boundary case - vector min.zig +1-1
...@@ -1,5 +1,5 @@...@@ -1,5 +1,5 @@
1const std = @import("std");1const std = @import("std");
2pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {2pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
3 _ = stack_trace;3 _ = stack_trace;
4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {4 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
5 std.process.exit(0);5 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - negative out of range.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {5 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - negative to unsigned.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {5 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@intFromFloat cannot fit - positive out of range.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {5 if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@ptrFromInt address zero to non-optional byte-aligned pointer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@ptrFromInt address zero to non-optional pointer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@ptrFromInt with misaligned address.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "incorrect alignment")) {5 if (std.mem.eql(u8, message, "incorrect alignment")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@tagName on corrupted enum value.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "invalid enum value")) {5 if (std.mem.eql(u8, message, "invalid enum value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/@tagName on corrupted union value.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "invalid enum value")) {5 if (std.mem.eql(u8, message, "invalid enum value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/array slice sentinel mismatch vector.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected { 0, 0 }, found { 4, 4 }")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected { 0, 0 }, found { 4, 4 }")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/array slice sentinel mismatch.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/bad union field access.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "access of union field 'float' while field 'int' is active")) {5 if (std.mem.eql(u8, message, "access of union field 'float' while field 'int' is active")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/calling panic.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "oh no")) {5 if (std.mem.eql(u8, message, "oh no")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/cast []u8 to bigger slice of wrong size.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "exact division produced remainder")) {5 if (std.mem.eql(u8, message, "exact division produced remainder")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/cast integer to global error and no code matches.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "invalid error code")) {5 if (std.mem.eql(u8, message, "invalid error code")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/empty slice with sentinel out of bounds.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "index out of bounds: index 1, len 0")) {5 if (std.mem.eql(u8, message, "index out of bounds: index 1, len 0")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/exact division failure - vectors.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "exact division produced remainder")) {5 if (std.mem.eql(u8, message, "exact division produced remainder")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/exact division failure.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "exact division produced remainder")) {5 if (std.mem.eql(u8, message, "exact division produced remainder")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/for_len_mismatch.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "for loop over objects with non-equal lengths")) {5 if (std.mem.eql(u8, message, "for loop over objects with non-equal lengths")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/for_len_mismatch_three.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "for loop over objects with non-equal lengths")) {5 if (std.mem.eql(u8, message, "for loop over objects with non-equal lengths")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/ignored expression integer overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/integer addition overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/integer division by zero - vectors.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "division by zero")) {5 if (std.mem.eql(u8, message, "division by zero")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/integer division by zero.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "division by zero")) {5 if (std.mem.eql(u8, message, "division by zero")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/integer multiplication overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/integer negation overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/integer subtraction overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/memcpy_alias.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "@memcpy arguments alias")) {5 if (std.mem.eql(u8, message, "@memcpy arguments alias")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/memcpy_len_mismatch.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "source and destination arguments have non-equal lengths")) {5 if (std.mem.eql(u8, message, "source and destination arguments have non-equal lengths")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/memmove_len_mismatch.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "source and destination arguments have non-equal lengths")) {5 if (std.mem.eql(u8, message, "source and destination arguments have non-equal lengths")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/memset_array_undefined_bytes.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/memset_array_undefined_large.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/memset_slice_undefined_bytes.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/memset_slice_undefined_large.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/modrem by zero.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "division by zero")) {5 if (std.mem.eql(u8, message, "division by zero")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/modulus by zero.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "division by zero")) {5 if (std.mem.eql(u8, message, "division by zero")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/noreturn returned.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "'noreturn' function returned")) {5 if (std.mem.eql(u8, message, "'noreturn' function returned")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/optional unwrap operator on C pointer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "attempt to use null value")) {5 if (std.mem.eql(u8, message, "attempt to use null value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/optional unwrap operator on null pointer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "attempt to use null value")) {5 if (std.mem.eql(u8, message, "attempt to use null value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/optional_empty_error_set.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, ra: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, ra: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 _ = ra;5 _ = ra;
6 if (std.mem.eql(u8, message, "attempt to use null value")) {6 if (std.mem.eql(u8, message, "attempt to use null value")) {
test/cases/safety/out of bounds array slice by length.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "index out of bounds: index 16, len 5")) {5 if (std.mem.eql(u8, message, "index out of bounds: index 16, len 5")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/out of bounds slice access.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "index out of bounds: index 4, len 4")) {5 if (std.mem.eql(u8, message, "index out of bounds: index 4, len 4")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/pointer casting null to non-optional pointer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/pointer casting to null function pointer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {5 if (std.mem.eql(u8, message, "cast causes pointer to be null")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/pointer slice sentinel mismatch.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/remainder division by zero.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "division by zero")) {5 if (std.mem.eql(u8, message, "division by zero")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/shift left by huge amount.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "shift amount is greater than the type size")) {5 if (std.mem.eql(u8, message, "shift amount is greater than the type size")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/shift right by huge amount.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "shift amount is greater than the type size")) {5 if (std.mem.eql(u8, message, "shift amount is greater than the type size")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/signed integer division overflow - vectors.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/signed integer division overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/signed integer not fitting in cast to unsigned integer - widening.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/signed integer not fitting in cast to unsigned integer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/signed shift left overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "left shift overflowed bits")) {5 if (std.mem.eql(u8, message, "left shift overflowed bits")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/signed shift right overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "right shift overflowed bits")) {5 if (std.mem.eql(u8, message, "right shift overflowed bits")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/signed-unsigned vector cast.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice by length sentinel mismatch on lhs.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 1, found 3")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 1, found 3")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice by length sentinel mismatch on rhs.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 1, found 0")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 1, found 0")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice sentinel mismatch - floats.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 1.2, found 4")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 1.2, found 4")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice sentinel mismatch - optional pointers.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected null, found i32@10")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected null, found i32@10")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice slice sentinel mismatch.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {5 if (std.mem.eql(u8, message, "sentinel mismatch: expected 0, found 4")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice start index greater than end index.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "start index 10 is larger than end index 1")) {5 if (std.mem.eql(u8, message, "start index 10 is larger than end index 1")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice with sentinel out of bounds - runtime len.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {5 if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice with sentinel out of bounds.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {5 if (std.mem.eql(u8, message, "index out of bounds: index 5, len 4")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slice_cast_change_len_0.zig+1-1
...@@ -13,7 +13,7 @@ pub fn main() void {...@@ -13,7 +13,7 @@ pub fn main() void {
13 std.process.exit(1);13 std.process.exit(1);
14}14}
1515
16pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {16pub fn panic(message: []const u8, _: ?*std.debug.StackTrace, _: ?usize) noreturn {
17 if (std.mem.eql(u8, message, "slice length '3' does not divide exactly into destination elements")) {17 if (std.mem.eql(u8, message, "slice length '3' does not divide exactly into destination elements")) {
18 std.process.exit(0);18 std.process.exit(0);
19 }19 }
test/cases/safety/slice_cast_change_len_1.zig+1-1
...@@ -13,7 +13,7 @@ pub fn main() void {...@@ -13,7 +13,7 @@ pub fn main() void {
13 std.process.exit(1);13 std.process.exit(1);
14}14}
1515
16pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {16pub fn panic(message: []const u8, _: ?*std.debug.StackTrace, _: ?usize) noreturn {
17 if (std.mem.eql(u8, message, "slice length '1' does not divide exactly into destination elements")) {17 if (std.mem.eql(u8, message, "slice length '1' does not divide exactly into destination elements")) {
18 std.process.exit(0);18 std.process.exit(0);
19 }19 }
test/cases/safety/slice_cast_change_len_2.zig+1-1
...@@ -13,7 +13,7 @@ pub fn main() void {...@@ -13,7 +13,7 @@ pub fn main() void {
13 std.process.exit(1);13 std.process.exit(1);
14}14}
1515
16pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {16pub fn panic(message: []const u8, _: ?*std.debug.StackTrace, _: ?usize) noreturn {
17 if (std.mem.eql(u8, message, "slice length '1' does not divide exactly into destination elements")) {17 if (std.mem.eql(u8, message, "slice length '1' does not divide exactly into destination elements")) {
18 std.process.exit(0);18 std.process.exit(0);
19 }19 }
test/cases/safety/slicing null C pointer - runtime len.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "attempt to use null value")) {5 if (std.mem.eql(u8, message, "attempt to use null value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/slicing null C pointer.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "attempt to use null value")) {5 if (std.mem.eql(u8, message, "attempt to use null value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/switch else on corrupt enum value - one prong.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "switch on corrupt value")) {5 if (std.mem.eql(u8, message, "switch on corrupt value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/switch else on corrupt enum value - union.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "switch on corrupt value")) {5 if (std.mem.eql(u8, message, "switch on corrupt value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/switch else on corrupt enum value.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "switch on corrupt value")) {5 if (std.mem.eql(u8, message, "switch on corrupt value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/switch on corrupted enum value.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "switch on corrupt value")) {5 if (std.mem.eql(u8, message, "switch on corrupt value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/switch on corrupted union value.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "switch on corrupt value")) {5 if (std.mem.eql(u8, message, "switch on corrupt value")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/truncating vector cast.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/unreachable.zig+1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "reached unreachable code")) {5 if (std.mem.eql(u8, message, "reached unreachable code")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/unsigned integer not fitting in cast to signed integer - same bit count.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/unsigned shift left overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "left shift overflowed bits")) {5 if (std.mem.eql(u8, message, "left shift overflowed bits")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/unsigned shift right overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "right shift overflowed bits")) {5 if (std.mem.eql(u8, message, "right shift overflowed bits")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/unsigned-signed vector cast.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/unwrap error switch.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "attempt to unwrap error: Whatever")) {5 if (std.mem.eql(u8, message, "attempt to unwrap error: Whatever")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/unwrap error.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "attempt to unwrap error: Whatever")) {5 if (std.mem.eql(u8, message, "attempt to unwrap error: Whatever")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/value does not fit in shortening cast - u0.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/value does not fit in shortening cast.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {5 if (std.mem.eql(u8, message, "integer does not fit in destination type")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/vector integer addition overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/vector integer multiplication overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/vector integer negation overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/vector integer subtraction overflow.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "integer overflow")) {5 if (std.mem.eql(u8, message, "integer overflow")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/safety/zero casted to error.zig +1-1
...@@ -1,6 +1,6 @@...@@ -1,6 +1,6 @@
1const std = @import("std");1const std = @import("std");
22
3pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {3pub fn panic(message: []const u8, stack_trace: ?*std.debug.StackTrace, _: ?usize) noreturn {
4 _ = stack_trace;4 _ = stack_trace;
5 if (std.mem.eql(u8, message, "invalid error code")) {5 if (std.mem.eql(u8, message, "invalid error code")) {
6 std.process.exit(0);6 std.process.exit(0);
test/cases/tail_call_noreturn.zig+2-2
...@@ -1,9 +1,9 @@...@@ -1,9 +1,9 @@
1const std = @import("std");1const std = @import("std");
2const builtin = std.builtin;2const builtin = std.builtin;
3pub fn foo(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn {3pub fn foo(message: []const u8, stack_trace: ?*std.debug.StackTrace) noreturn {
4 @call(.always_tail, bar, .{ message, stack_trace });4 @call(.always_tail, bar, .{ message, stack_trace });
5}5}
6pub fn bar(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn {6pub fn bar(message: []const u8, stack_trace: ?*std.debug.StackTrace) noreturn {
7 _ = message;7 _ = message;
8 _ = stack_trace;8 _ = stack_trace;
9 std.process.exit(0);9 std.process.exit(0);
test/stack_traces.zig+9-9
...@@ -118,13 +118,13 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext) void {...@@ -118,13 +118,13 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext) void {
118 \\ var stack_trace_buf: [8]usize = undefined;118 \\ var stack_trace_buf: [8]usize = undefined;
119 \\ dumpIt(&captureIt(&stack_trace_buf));119 \\ dumpIt(&captureIt(&stack_trace_buf));
120 \\}120 \\}
121 \\fn captureIt(buf: []usize) std.builtin.StackTrace {121 \\fn captureIt(buf: []usize) std.debug.StackTrace {
122 \\ return captureItInner(buf);122 \\ return captureItInner(buf);
123 \\}123 \\}
124 \\fn dumpIt(st: *const std.builtin.StackTrace) void {124 \\fn dumpIt(st: *const std.debug.StackTrace) void {
125 \\ std.debug.dumpStackTrace(st);125 \\ std.debug.dumpStackTrace(st);
126 \\}126 \\}
127 \\fn captureItInner(buf: []usize) std.builtin.StackTrace {127 \\fn captureItInner(buf: []usize) std.debug.StackTrace {
128 \\ return std.debug.captureCurrentStackTrace(.{}, buf);128 \\ return std.debug.captureCurrentStackTrace(.{}, buf);
129 \\}129 \\}
130 \\const std = @import("std");130 \\const std = @import("std");
...@@ -159,13 +159,13 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext) void {...@@ -159,13 +159,13 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext) void {
159 \\ var stack_trace_buf: [8]usize = undefined;159 \\ var stack_trace_buf: [8]usize = undefined;
160 \\ dumpIt(&captureIt(&stack_trace_buf));160 \\ dumpIt(&captureIt(&stack_trace_buf));
161 \\}161 \\}
162 \\fn captureIt(buf: []usize) std.builtin.StackTrace {162 \\fn captureIt(buf: []usize) std.debug.StackTrace {
163 \\ return captureItInner(buf);163 \\ return captureItInner(buf);
164 \\}164 \\}
165 \\fn dumpIt(st: *const std.builtin.StackTrace) void {165 \\fn dumpIt(st: *const std.debug.StackTrace) void {
166 \\ std.debug.dumpStackTrace(st);166 \\ std.debug.dumpStackTrace(st);
167 \\}167 \\}
168 \\fn captureItInner(buf: []usize) std.builtin.StackTrace {168 \\fn captureItInner(buf: []usize) std.debug.StackTrace {
169 \\ return std.debug.captureCurrentStackTrace(.{}, buf);169 \\ return std.debug.captureCurrentStackTrace(.{}, buf);
170 \\}170 \\}
171 \\const std = @import("std");171 \\const std = @import("std");
...@@ -188,13 +188,13 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext) void {...@@ -188,13 +188,13 @@ pub fn addCases(cases: *@import("tests.zig").StackTracesContext) void {
188 \\fn threadMain(stack_trace_buf: []usize) void {188 \\fn threadMain(stack_trace_buf: []usize) void {
189 \\ dumpIt(&captureIt(stack_trace_buf));189 \\ dumpIt(&captureIt(stack_trace_buf));
190 \\}190 \\}
191 \\fn captureIt(buf: []usize) std.builtin.StackTrace {191 \\fn captureIt(buf: []usize) std.debug.StackTrace {
192 \\ return captureItInner(buf);192 \\ return captureItInner(buf);
193 \\}193 \\}
194 \\fn dumpIt(st: *const std.builtin.StackTrace) void {194 \\fn dumpIt(st: *const std.debug.StackTrace) void {
195 \\ std.debug.dumpStackTrace(st);195 \\ std.debug.dumpStackTrace(st);
196 \\}196 \\}
197 \\fn captureItInner(buf: []usize) std.builtin.StackTrace {197 \\fn captureItInner(buf: []usize) std.debug.StackTrace {
198 \\ return std.debug.captureCurrentStackTrace(.{}, buf);198 \\ return std.debug.captureCurrentStackTrace(.{}, buf);
199 \\}199 \\}
200 \\const std = @import("std");200 \\const std = @import("std");
test/standalone/compile_asm/main.zig+1-1
...@@ -4,7 +4,7 @@ export fn main(r0: u32, r1: u32, atags: u32) callconv(.c) noreturn {...@@ -4,7 +4,7 @@ export fn main(r0: u32, r1: u32, atags: u32) callconv(.c) noreturn {
4 _ = atags;4 _ = atags;
5 unreachable; // never gets run so it doesn't matter5 unreachable; // never gets run so it doesn't matter
6}6}
7pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn {7pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").debug.StackTrace, _: ?usize) noreturn {
8 _ = msg;8 _ = msg;
9 _ = error_return_trace;9 _ = error_return_trace;
10 while (true) {}10 while (true) {}
test/standalone/issue_339/test.zig+1-1
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const StackTrace = @import("std").builtin.StackTrace;1const StackTrace = @import("std").debug.StackTrace;
2pub fn panic(msg: []const u8, stack_trace: ?*StackTrace, _: ?usize) noreturn {2pub fn panic(msg: []const u8, stack_trace: ?*StackTrace, _: ?usize) noreturn {
3 _ = msg;3 _ = msg;
4 _ = stack_trace;4 _ = stack_trace;
test/tests.zig+1-1
...@@ -2200,7 +2200,7 @@ pub fn addCliTests(b: *std.Build) *Step {...@@ -2200,7 +2200,7 @@ pub fn addCliTests(b: *std.Build) *Step {
2200 \\ return num * num;2200 \\ return num * num;
2201 \\}2201 \\}
2202 \\extern fn zig_panic() noreturn;2202 \\extern fn zig_panic() noreturn;
2203 \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn {2203 \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").debug.StackTrace, _: ?usize) noreturn {
2204 \\ _ = msg;2204 \\ _ = msg;
2205 \\ _ = error_return_trace;2205 \\ _ = error_return_trace;
2206 \\ zig_panic();2206 \\ zig_panic();