| author | |
| committer | |
| log | 902f6db67b2d25f238fb13e458a12e06df62dadb |
| tree | 5736f130758bcdc22babb60ac2ded441d43eb28e |
| parent | 62ecc154d9ad065aee57d81afd3a478dd8360fb7 |
| parent | d7d21672b83b64fd522a5998780bfde6ef724557 |
| signature |
safety: show error return trace when unwrapping error in switch95 files changed, 307 insertions(+), 182 deletions(-)
ci/azure/pipelines.yml+1-1| ... | @@ -16,7 +16,7 @@ jobs: | ... | @@ -16,7 +16,7 @@ jobs: |
| 16 | vmImage: 'windows-2019' | 16 | vmImage: 'windows-2019' |
| 17 | variables: | 17 | variables: |
| 18 | TARGET: 'x86_64-windows-gnu' | 18 | TARGET: 'x86_64-windows-gnu' |
| 19 | ZIG_LLVM_CLANG_LLD_NAME: 'zig+llvm+lld+clang-${{ variables.TARGET }}-0.10.0-dev.61+9be8396b7' | 19 | ZIG_LLVM_CLANG_LLD_NAME: 'zig+llvm+lld+clang-${{ variables.TARGET }}-0.10.0-dev.4138+3f5ee6f03' |
| 20 | ZIG_LLVM_CLANG_LLD_URL: 'https://ziglang.org/deps/${{ variables.ZIG_LLVM_CLANG_LLD_NAME }}.zip' | 20 | ZIG_LLVM_CLANG_LLD_URL: 'https://ziglang.org/deps/${{ variables.ZIG_LLVM_CLANG_LLD_NAME }}.zip' |
| 21 | steps: | 21 | steps: |
| 22 | - pwsh: | | 22 | - pwsh: | |
lib/c.zig+1-1| ... | @@ -58,7 +58,7 @@ comptime { | ... | @@ -58,7 +58,7 @@ comptime { |
| 58 | 58 | ||
| 59 | // Avoid dragging in the runtime safety mechanisms into this .o file, | 59 | // Avoid dragging in the runtime safety mechanisms into this .o file, |
| 60 | // unless we're trying to test this file. | 60 | // unless we're trying to test this file. |
| 61 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { | 61 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 62 | @setCold(true); | 62 | @setCold(true); |
| 63 | _ = error_return_trace; | 63 | _ = error_return_trace; |
| 64 | if (builtin.is_test) { | 64 | if (builtin.is_test) { |
lib/compiler_rt/common.zig+1-1| ... | @@ -60,7 +60,7 @@ pub const want_sparc_abi = builtin.cpu.arch.isSPARC(); | ... | @@ -60,7 +60,7 @@ pub const want_sparc_abi = builtin.cpu.arch.isSPARC(); |
| 60 | 60 | ||
| 61 | // Avoid dragging in the runtime safety mechanisms into this .o file, | 61 | // Avoid dragging in the runtime safety mechanisms into this .o file, |
| 62 | // unless we're trying to test compiler-rt. | 62 | // unless we're trying to test compiler-rt. |
| 63 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { | 63 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 64 | _ = error_return_trace; | 64 | _ = error_return_trace; |
| 65 | if (builtin.is_test) { | 65 | if (builtin.is_test) { |
| 66 | @setCold(true); | 66 | @setCold(true); |
lib/ssp.zig+1-1| ... | @@ -20,7 +20,7 @@ extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) call | ... | @@ -20,7 +20,7 @@ extern fn memcpy(noalias dest: ?[*]u8, noalias src: ?[*]const u8, n: usize) call |
| 20 | extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8; | 20 | extern fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8; |
| 21 | 21 | ||
| 22 | // Avoid dragging in the runtime safety mechanisms into this .o file. | 22 | // Avoid dragging in the runtime safety mechanisms into this .o file. |
| 23 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { | 23 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 24 | _ = msg; | 24 | _ = msg; |
| 25 | _ = error_return_trace; | 25 | _ = error_return_trace; |
| 26 | @setCold(true); | 26 | @setCold(true); |
lib/std/builtin.zig+6-6| ... | @@ -748,7 +748,7 @@ const testFnProto = switch (builtin.zig_backend) { | ... | @@ -748,7 +748,7 @@ const testFnProto = switch (builtin.zig_backend) { |
| 748 | 748 | ||
| 749 | /// This function type is used by the Zig language code generation and | 749 | /// This function type is used by the Zig language code generation and |
| 750 | /// therefore must be kept in sync with the compiler implementation. | 750 | /// therefore must be kept in sync with the compiler implementation. |
| 751 | pub const PanicFn = fn ([]const u8, ?*StackTrace) noreturn; | 751 | pub const PanicFn = fn ([]const u8, ?*StackTrace, ?usize) noreturn; |
| 752 | 752 | ||
| 753 | /// This function is used by the Zig language code generation and | 753 | /// This function is used by the Zig language code generation and |
| 754 | /// therefore must be kept in sync with the compiler implementation. | 754 | /// therefore must be kept in sync with the compiler implementation. |
| ... | @@ -761,7 +761,7 @@ else | ... | @@ -761,7 +761,7 @@ else |
| 761 | 761 | ||
| 762 | /// This function is used by the Zig language code generation and | 762 | /// This function is used by the Zig language code generation and |
| 763 | /// therefore must be kept in sync with the compiler implementation. | 763 | /// therefore must be kept in sync with the compiler implementation. |
| 764 | pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn { | 764 | pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn { |
| 765 | @setCold(true); | 765 | @setCold(true); |
| 766 | 766 | ||
| 767 | // Until self-hosted catches up with stage1 language features, we have a simpler | 767 | // Until self-hosted catches up with stage1 language features, we have a simpler |
| ... | @@ -839,7 +839,7 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn | ... | @@ -839,7 +839,7 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn |
| 839 | std.os.abort(); | 839 | std.os.abort(); |
| 840 | }, | 840 | }, |
| 841 | else => { | 841 | else => { |
| 842 | const first_trace_addr = @returnAddress(); | 842 | const first_trace_addr = ret_addr orelse @returnAddress(); |
| 843 | std.debug.panicImpl(error_return_trace, first_trace_addr, msg); | 843 | std.debug.panicImpl(error_return_trace, first_trace_addr, msg); |
| 844 | }, | 844 | }, |
| 845 | } | 845 | } |
| ... | @@ -853,17 +853,17 @@ pub fn checkNonScalarSentinel(expected: anytype, actual: @TypeOf(expected)) void | ... | @@ -853,17 +853,17 @@ pub fn checkNonScalarSentinel(expected: anytype, actual: @TypeOf(expected)) void |
| 853 | 853 | ||
| 854 | pub fn panicSentinelMismatch(expected: anytype, actual: @TypeOf(expected)) noreturn { | 854 | pub fn panicSentinelMismatch(expected: anytype, actual: @TypeOf(expected)) noreturn { |
| 855 | @setCold(true); | 855 | @setCold(true); |
| 856 | std.debug.panic("sentinel mismatch: expected {any}, found {any}", .{ expected, actual }); | 856 | std.debug.panicExtra(null, @returnAddress(), "sentinel mismatch: expected {any}, found {any}", .{ expected, actual }); |
| 857 | } | 857 | } |
| 858 | 858 | ||
| 859 | pub fn panicUnwrapError(st: ?*StackTrace, err: anyerror) noreturn { | 859 | pub fn panicUnwrapError(st: ?*StackTrace, err: anyerror) noreturn { |
| 860 | @setCold(true); | 860 | @setCold(true); |
| 861 | std.debug.panicExtra(st, "attempt to unwrap error: {s}", .{@errorName(err)}); | 861 | std.debug.panicExtra(st, @returnAddress(), "attempt to unwrap error: {s}", .{@errorName(err)}); |
| 862 | } | 862 | } |
| 863 | 863 | ||
| 864 | pub fn panicOutOfBounds(index: usize, len: usize) noreturn { | 864 | pub fn panicOutOfBounds(index: usize, len: usize) noreturn { |
| 865 | @setCold(true); | 865 | @setCold(true); |
| 866 | std.debug.panic("index out of bounds: index {d}, len {d}", .{ index, len }); | 866 | std.debug.panicExtra(null, @returnAddress(), "index out of bounds: index {d}, len {d}", .{ index, len }); |
| 867 | } | 867 | } |
| 868 | 868 | ||
| 869 | pub noinline fn returnError(st: *StackTrace) void { | 869 | pub noinline fn returnError(st: *StackTrace) void { |
lib/std/debug.zig+3-2| ... | @@ -284,13 +284,14 @@ pub fn assert(ok: bool) void { | ... | @@ -284,13 +284,14 @@ pub fn assert(ok: bool) void { |
| 284 | pub fn panic(comptime format: []const u8, args: anytype) noreturn { | 284 | pub fn panic(comptime format: []const u8, args: anytype) noreturn { |
| 285 | @setCold(true); | 285 | @setCold(true); |
| 286 | 286 | ||
| 287 | panicExtra(null, format, args); | 287 | panicExtra(null, null, format, args); |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | /// `panicExtra` is useful when you want to print out an `@errorReturnTrace` | 290 | /// `panicExtra` is useful when you want to print out an `@errorReturnTrace` |
| 291 | /// and also print out some values. | 291 | /// and also print out some values. |
| 292 | pub fn panicExtra( | 292 | pub fn panicExtra( |
| 293 | trace: ?*std.builtin.StackTrace, | 293 | trace: ?*std.builtin.StackTrace, |
| 294 | ret_addr: ?usize, | ||
| 294 | comptime format: []const u8, | 295 | comptime format: []const u8, |
| 295 | args: anytype, | 296 | args: anytype, |
| 296 | ) noreturn { | 297 | ) noreturn { |
| ... | @@ -308,7 +309,7 @@ pub fn panicExtra( | ... | @@ -308,7 +309,7 @@ pub fn panicExtra( |
| 308 | break :blk &buf; | 309 | break :blk &buf; |
| 309 | }, | 310 | }, |
| 310 | }; | 311 | }; |
| 311 | std.builtin.panic(msg, trace); | 312 | std.builtin.panic(msg, trace, ret_addr); |
| 312 | } | 313 | } |
| 313 | 314 | ||
| 314 | /// Non-zero whenever the program triggered a panic. | 315 | /// Non-zero whenever the program triggered a panic. |
src/AstGen.zig-29| ... | @@ -884,33 +884,6 @@ fn expr(gz: *GenZir, scope: *Scope, rl: ResultLoc, node: Ast.Node.Index) InnerEr | ... | @@ -884,33 +884,6 @@ fn expr(gz: *GenZir, scope: *Scope, rl: ResultLoc, node: Ast.Node.Index) InnerEr |
| 884 | catch_token + 2 | 884 | catch_token + 2 |
| 885 | else | 885 | else |
| 886 | null; | 886 | null; |
| 887 | |||
| 888 | var rhs = node_datas[node].rhs; | ||
| 889 | while (true) switch (node_tags[rhs]) { | ||
| 890 | .grouped_expression => rhs = node_datas[rhs].lhs, | ||
| 891 | .unreachable_literal => { | ||
| 892 | if (payload_token != null and mem.eql(u8, tree.tokenSlice(payload_token.?), "_")) { | ||
| 893 | return astgen.failTok(payload_token.?, "discard of error capture; omit it instead", .{}); | ||
| 894 | } else if (payload_token != null) { | ||
| 895 | return astgen.failTok(payload_token.?, "unused capture", .{}); | ||
| 896 | } | ||
| 897 | const lhs = node_datas[node].lhs; | ||
| 898 | |||
| 899 | const operand = try reachableExpr(gz, scope, switch (rl) { | ||
| 900 | .ref => .ref, | ||
| 901 | else => .none, | ||
| 902 | }, lhs, lhs); | ||
| 903 | const result = try gz.addUnNode(switch (rl) { | ||
| 904 | .ref => .err_union_payload_safe_ptr, | ||
| 905 | else => .err_union_payload_safe, | ||
| 906 | }, operand, node); | ||
| 907 | switch (rl) { | ||
| 908 | .none, .coerced_ty, .discard, .ref => return result, | ||
| 909 | else => return rvalue(gz, rl, result, lhs), | ||
| 910 | } | ||
| 911 | }, | ||
| 912 | else => break, | ||
| 913 | }; | ||
| 914 | switch (rl) { | 887 | switch (rl) { |
| 915 | .ref => return orelseCatchExpr( | 888 | .ref => return orelseCatchExpr( |
| 916 | gz, | 889 | gz, |
| ... | @@ -2375,9 +2348,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As | ... | @@ -2375,9 +2348,7 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2375 | .optional_payload_unsafe, | 2348 | .optional_payload_unsafe, |
| 2376 | .optional_payload_safe_ptr, | 2349 | .optional_payload_safe_ptr, |
| 2377 | .optional_payload_unsafe_ptr, | 2350 | .optional_payload_unsafe_ptr, |
| 2378 | .err_union_payload_safe, | ||
| 2379 | .err_union_payload_unsafe, | 2351 | .err_union_payload_unsafe, |
| 2380 | .err_union_payload_safe_ptr, | ||
| 2381 | .err_union_payload_unsafe_ptr, | 2352 | .err_union_payload_unsafe_ptr, |
| 2382 | .err_union_code, | 2353 | .err_union_code, |
| 2383 | .err_union_code_ptr, | 2354 | .err_union_code_ptr, |
src/Sema.zig+175-37| ... | @@ -747,10 +747,8 @@ fn analyzeBodyInner( | ... | @@ -747,10 +747,8 @@ fn analyzeBodyInner( |
| 747 | .int_to_enum => try sema.zirIntToEnum(block, inst), | 747 | .int_to_enum => try sema.zirIntToEnum(block, inst), |
| 748 | .err_union_code => try sema.zirErrUnionCode(block, inst), | 748 | .err_union_code => try sema.zirErrUnionCode(block, inst), |
| 749 | .err_union_code_ptr => try sema.zirErrUnionCodePtr(block, inst), | 749 | .err_union_code_ptr => try sema.zirErrUnionCodePtr(block, inst), |
| 750 | .err_union_payload_safe => try sema.zirErrUnionPayload(block, inst, true), | 750 | .err_union_payload_unsafe => try sema.zirErrUnionPayload(block, inst), |
| 751 | .err_union_payload_safe_ptr => try sema.zirErrUnionPayloadPtr(block, inst, true), | 751 | .err_union_payload_unsafe_ptr => try sema.zirErrUnionPayloadPtr(block, inst), |
| 752 | .err_union_payload_unsafe => try sema.zirErrUnionPayload(block, inst, false), | ||
| 753 | .err_union_payload_unsafe_ptr => try sema.zirErrUnionPayloadPtr(block, inst, false), | ||
| 754 | .error_union_type => try sema.zirErrorUnionType(block, inst), | 752 | .error_union_type => try sema.zirErrorUnionType(block, inst), |
| 755 | .error_value => try sema.zirErrorValue(block, inst), | 753 | .error_value => try sema.zirErrorValue(block, inst), |
| 756 | .field_ptr => try sema.zirFieldPtr(block, inst, false), | 754 | .field_ptr => try sema.zirFieldPtr(block, inst, false), |
| ... | @@ -1355,6 +1353,8 @@ fn analyzeBodyInner( | ... | @@ -1355,6 +1353,8 @@ fn analyzeBodyInner( |
| 1355 | const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; | 1353 | const else_body = sema.code.extra[extra.end + then_body.len ..][0..extra.data.else_body_len]; |
| 1356 | const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime known"); | 1354 | const cond = try sema.resolveInstConst(block, cond_src, extra.data.condition, "condition in comptime branch must be comptime known"); |
| 1357 | const inline_body = if (cond.val.toBool()) then_body else else_body; | 1355 | const inline_body = if (cond.val.toBool()) then_body else else_body; |
| 1356 | |||
| 1357 | try sema.maybeErrorUnwrapCondbr(block, inline_body, extra.data.condition, cond_src); | ||
| 1358 | const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse | 1358 | const break_data = (try sema.analyzeBodyBreak(block, inline_body)) orelse |
| 1359 | break always_noreturn; | 1359 | break always_noreturn; |
| 1360 | if (inst == break_data.block_inst) { | 1360 | if (inst == break_data.block_inst) { |
| ... | @@ -1955,7 +1955,7 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { | ... | @@ -1955,7 +1955,7 @@ fn failWithOwnedErrorMsg(sema: *Sema, err_msg: *Module.ErrorMsg) CompileError { |
| 1955 | err_msg.src_loc.file_scope.sub_file_path, | 1955 | err_msg.src_loc.file_scope.sub_file_path, |
| 1956 | err_msg.src_loc.lazy, | 1956 | err_msg.src_loc.lazy, |
| 1957 | }); | 1957 | }); |
| 1958 | crash_report.compilerPanic("unexpected compile error occurred", null); | 1958 | crash_report.compilerPanic("unexpected compile error occurred", null, null); |
| 1959 | } | 1959 | } |
| 1960 | 1960 | ||
| 1961 | const mod = sema.mod; | 1961 | const mod = sema.mod; |
| ... | @@ -7426,7 +7426,6 @@ fn zirErrUnionPayload( | ... | @@ -7426,7 +7426,6 @@ fn zirErrUnionPayload( |
| 7426 | sema: *Sema, | 7426 | sema: *Sema, |
| 7427 | block: *Block, | 7427 | block: *Block, |
| 7428 | inst: Zir.Inst.Index, | 7428 | inst: Zir.Inst.Index, |
| 7429 | safety_check: bool, | ||
| 7430 | ) CompileError!Air.Inst.Ref { | 7429 | ) CompileError!Air.Inst.Ref { |
| 7431 | const tracy = trace(@src()); | 7430 | const tracy = trace(@src()); |
| 7432 | defer tracy.end(); | 7431 | defer tracy.end(); |
| ... | @@ -7441,7 +7440,7 @@ fn zirErrUnionPayload( | ... | @@ -7441,7 +7440,7 @@ fn zirErrUnionPayload( |
| 7441 | err_union_ty.fmt(sema.mod), | 7440 | err_union_ty.fmt(sema.mod), |
| 7442 | }); | 7441 | }); |
| 7443 | } | 7442 | } |
| 7444 | return sema.analyzeErrUnionPayload(block, src, err_union_ty, operand, operand_src, safety_check); | 7443 | return sema.analyzeErrUnionPayload(block, src, err_union_ty, operand, operand_src, false); |
| 7445 | } | 7444 | } |
| 7446 | 7445 | ||
| 7447 | fn analyzeErrUnionPayload( | 7446 | fn analyzeErrUnionPayload( |
| ... | @@ -7479,7 +7478,6 @@ fn zirErrUnionPayloadPtr( | ... | @@ -7479,7 +7478,6 @@ fn zirErrUnionPayloadPtr( |
| 7479 | sema: *Sema, | 7478 | sema: *Sema, |
| 7480 | block: *Block, | 7479 | block: *Block, |
| 7481 | inst: Zir.Inst.Index, | 7480 | inst: Zir.Inst.Index, |
| 7482 | safety_check: bool, | ||
| 7483 | ) CompileError!Air.Inst.Ref { | 7481 | ) CompileError!Air.Inst.Ref { |
| 7484 | const tracy = trace(@src()); | 7482 | const tracy = trace(@src()); |
| 7485 | defer tracy.end(); | 7483 | defer tracy.end(); |
| ... | @@ -7488,7 +7486,7 @@ fn zirErrUnionPayloadPtr( | ... | @@ -7488,7 +7486,7 @@ fn zirErrUnionPayloadPtr( |
| 7488 | const operand = try sema.resolveInst(inst_data.operand); | 7486 | const operand = try sema.resolveInst(inst_data.operand); |
| 7489 | const src = inst_data.src(); | 7487 | const src = inst_data.src(); |
| 7490 | 7488 | ||
| 7491 | return sema.analyzeErrUnionPayloadPtr(block, src, operand, safety_check, false); | 7489 | return sema.analyzeErrUnionPayloadPtr(block, src, operand, false, false); |
| 7492 | } | 7490 | } |
| 7493 | 7491 | ||
| 7494 | fn analyzeErrUnionPayloadPtr( | 7492 | fn analyzeErrUnionPayloadPtr( |
| ... | @@ -9247,6 +9245,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9247,6 +9245,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9247 | var empty_enum = false; | 9245 | var empty_enum = false; |
| 9248 | 9246 | ||
| 9249 | const operand_ty = sema.typeOf(operand); | 9247 | const operand_ty = sema.typeOf(operand); |
| 9248 | const err_set = operand_ty.zigTypeTag() == .ErrorSet; | ||
| 9250 | 9249 | ||
| 9251 | var else_error_ty: ?Type = null; | 9250 | var else_error_ty: ?Type = null; |
| 9252 | 9251 | ||
| ... | @@ -9829,6 +9828,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9829,6 +9828,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9829 | // Validation above ensured these will succeed. | 9828 | // Validation above ensured these will succeed. |
| 9830 | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, undefined) catch unreachable; | 9829 | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, undefined) catch unreachable; |
| 9831 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { | 9830 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { |
| 9831 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); | ||
| 9832 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); | 9832 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); |
| 9833 | } | 9833 | } |
| 9834 | } | 9834 | } |
| ... | @@ -9851,6 +9851,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9851,6 +9851,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9851 | // Validation above ensured these will succeed. | 9851 | // Validation above ensured these will succeed. |
| 9852 | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, undefined) catch unreachable; | 9852 | const item_val = sema.resolveConstValue(&child_block, .unneeded, item, undefined) catch unreachable; |
| 9853 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { | 9853 | if (operand_val.eql(item_val, operand_ty, sema.mod)) { |
| 9854 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); | ||
| 9854 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); | 9855 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); |
| 9855 | } | 9856 | } |
| 9856 | } | 9857 | } |
| ... | @@ -9868,6 +9869,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9868,6 +9869,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9868 | if ((try sema.compare(block, src, operand_val, .gte, first_tv.val, operand_ty)) and | 9869 | if ((try sema.compare(block, src, operand_val, .gte, first_tv.val, operand_ty)) and |
| 9869 | (try sema.compare(block, src, operand_val, .lte, last_tv.val, operand_ty))) | 9870 | (try sema.compare(block, src, operand_val, .lte, last_tv.val, operand_ty))) |
| 9870 | { | 9871 | { |
| 9872 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, body, operand); | ||
| 9871 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); | 9873 | return sema.resolveBlockBody(block, src, &child_block, body, inst, merges); |
| 9872 | } | 9874 | } |
| 9873 | } | 9875 | } |
| ... | @@ -9875,6 +9877,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9875,6 +9877,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9875 | extra_index += body_len; | 9877 | extra_index += body_len; |
| 9876 | } | 9878 | } |
| 9877 | } | 9879 | } |
| 9880 | if (err_set) try sema.maybeErrorUnwrapComptime(&child_block, special.body, operand); | ||
| 9878 | return sema.resolveBlockBody(block, src, &child_block, special.body, inst, merges); | 9881 | return sema.resolveBlockBody(block, src, &child_block, special.body, inst, merges); |
| 9879 | } | 9882 | } |
| 9880 | 9883 | ||
| ... | @@ -9885,6 +9888,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9885,6 +9888,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9885 | if (special_prong == .none) { | 9888 | if (special_prong == .none) { |
| 9886 | return sema.fail(block, src, "switch must handle all possibilities", .{}); | 9889 | return sema.fail(block, src, "switch must handle all possibilities", .{}); |
| 9887 | } | 9890 | } |
| 9891 | if (err_set and try sema.maybeErrorUnwrap(block, special.body, operand)) { | ||
| 9892 | return Air.Inst.Ref.unreachable_value; | ||
| 9893 | } | ||
| 9888 | return sema.resolveBlockBody(block, src, &child_block, special.body, inst, merges); | 9894 | return sema.resolveBlockBody(block, src, &child_block, special.body, inst, merges); |
| 9889 | } | 9895 | } |
| 9890 | 9896 | ||
| ... | @@ -9927,7 +9933,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9927,7 +9933,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9927 | break :blk field_ty.zigTypeTag() != .NoReturn; | 9933 | break :blk field_ty.zigTypeTag() != .NoReturn; |
| 9928 | } else true; | 9934 | } else true; |
| 9929 | 9935 | ||
| 9930 | if (analyze_body) { | 9936 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand)) { |
| 9937 | // nothing to do here | ||
| 9938 | } else if (analyze_body) { | ||
| 9931 | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { | 9939 | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 9932 | error.ComptimeBreak => { | 9940 | error.ComptimeBreak => { |
| 9933 | const zir_datas = sema.code.instructions.items(.data); | 9941 | const zir_datas = sema.code.instructions.items(.data); |
| ... | @@ -9995,7 +10003,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -9995,7 +10003,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 9995 | 10003 | ||
| 9996 | const body = sema.code.extra[extra_index..][0..body_len]; | 10004 | const body = sema.code.extra[extra_index..][0..body_len]; |
| 9997 | extra_index += body_len; | 10005 | extra_index += body_len; |
| 9998 | if (analyze_body) { | 10006 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand)) { |
| 10007 | // nothing to do here | ||
| 10008 | } else if (analyze_body) { | ||
| 9999 | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { | 10009 | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 10000 | error.ComptimeBreak => { | 10010 | error.ComptimeBreak => { |
| 10001 | const zir_datas = sema.code.instructions.items(.data); | 10011 | const zir_datas = sema.code.instructions.items(.data); |
| ... | @@ -10085,18 +10095,22 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -10085,18 +10095,22 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10085 | 10095 | ||
| 10086 | const body = sema.code.extra[extra_index..][0..body_len]; | 10096 | const body = sema.code.extra[extra_index..][0..body_len]; |
| 10087 | extra_index += body_len; | 10097 | extra_index += body_len; |
| 10088 | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { | 10098 | if (err_set and try sema.maybeErrorUnwrap(&case_block, body, operand)) { |
| 10089 | error.ComptimeBreak => { | 10099 | // nothing to do here |
| 10090 | const zir_datas = sema.code.instructions.items(.data); | 10100 | } else { |
| 10091 | const break_data = zir_datas[sema.comptime_break_inst].@"break"; | 10101 | _ = sema.analyzeBodyInner(&case_block, body) catch |err| switch (err) { |
| 10092 | try sema.addRuntimeBreak(&case_block, .{ | 10102 | error.ComptimeBreak => { |
| 10093 | .block_inst = break_data.block_inst, | 10103 | const zir_datas = sema.code.instructions.items(.data); |
| 10094 | .operand = break_data.operand, | 10104 | const break_data = zir_datas[sema.comptime_break_inst].@"break"; |
| 10095 | .inst = sema.comptime_break_inst, | 10105 | try sema.addRuntimeBreak(&case_block, .{ |
| 10096 | }); | 10106 | .block_inst = break_data.block_inst, |
| 10097 | }, | 10107 | .operand = break_data.operand, |
| 10098 | else => |e| return e, | 10108 | .inst = sema.comptime_break_inst, |
| 10099 | }; | 10109 | }); |
| 10110 | }, | ||
| 10111 | else => |e| return e, | ||
| 10112 | }; | ||
| 10113 | } | ||
| 10100 | 10114 | ||
| 10101 | try wip_captures.finalize(); | 10115 | try wip_captures.finalize(); |
| 10102 | 10116 | ||
| ... | @@ -10141,8 +10155,11 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -10141,8 +10155,11 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 10141 | } else false | 10155 | } else false |
| 10142 | else | 10156 | else |
| 10143 | true; | 10157 | true; |
| 10144 | 10158 | if (special.body.len != 0 and err_set and | |
| 10145 | if (special.body.len != 0 and analyze_body) { | 10159 | try sema.maybeErrorUnwrap(&case_block, special.body, operand)) |
| 10160 | { | ||
| 10161 | // nothing to do here | ||
| 10162 | } else if (special.body.len != 0 and analyze_body) { | ||
| 10146 | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { | 10163 | _ = sema.analyzeBodyInner(&case_block, special.body) catch |err| switch (err) { |
| 10147 | error.ComptimeBreak => { | 10164 | error.ComptimeBreak => { |
| 10148 | const zir_datas = sema.code.instructions.items(.data); | 10165 | const zir_datas = sema.code.instructions.items(.data); |
| ... | @@ -10400,6 +10417,109 @@ fn validateSwitchNoRange( | ... | @@ -10400,6 +10417,109 @@ fn validateSwitchNoRange( |
| 10400 | return sema.failWithOwnedErrorMsg(msg); | 10417 | return sema.failWithOwnedErrorMsg(msg); |
| 10401 | } | 10418 | } |
| 10402 | 10419 | ||
| 10420 | fn maybeErrorUnwrap(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, operand: Air.Inst.Ref) !bool { | ||
| 10421 | const this_feature_is_implemented_in_the_backend = | ||
| 10422 | sema.mod.comp.bin_file.options.use_llvm; | ||
| 10423 | |||
| 10424 | if (!this_feature_is_implemented_in_the_backend) return false; | ||
| 10425 | |||
| 10426 | const tags = sema.code.instructions.items(.tag); | ||
| 10427 | for (body) |inst| { | ||
| 10428 | switch (tags[inst]) { | ||
| 10429 | .dbg_block_begin, | ||
| 10430 | .dbg_block_end, | ||
| 10431 | .dbg_stmt, | ||
| 10432 | .@"unreachable", | ||
| 10433 | .str, | ||
| 10434 | .as_node, | ||
| 10435 | .panic, | ||
| 10436 | .field_val, | ||
| 10437 | => {}, | ||
| 10438 | else => return false, | ||
| 10439 | } | ||
| 10440 | } | ||
| 10441 | |||
| 10442 | for (body) |inst| { | ||
| 10443 | const air_inst = switch (tags[inst]) { | ||
| 10444 | .dbg_block_begin, | ||
| 10445 | .dbg_block_end, | ||
| 10446 | => continue, | ||
| 10447 | .dbg_stmt => { | ||
| 10448 | try sema.zirDbgStmt(block, inst); | ||
| 10449 | continue; | ||
| 10450 | }, | ||
| 10451 | .str => try sema.zirStr(block, inst), | ||
| 10452 | .as_node => try sema.zirAsNode(block, inst), | ||
| 10453 | .field_val => try sema.zirFieldVal(block, inst), | ||
| 10454 | .@"unreachable" => { | ||
| 10455 | const inst_data = sema.code.instructions.items(.data)[inst].@"unreachable"; | ||
| 10456 | const src = inst_data.src(); | ||
| 10457 | |||
| 10458 | const panic_fn = try sema.getBuiltin(block, src, "panicUnwrapError"); | ||
| 10459 | const err_return_trace = try sema.getErrorReturnTrace(block, src); | ||
| 10460 | const args: [2]Air.Inst.Ref = .{ err_return_trace, operand }; | ||
| 10461 | _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null); | ||
| 10462 | return true; | ||
| 10463 | }, | ||
| 10464 | .panic => { | ||
| 10465 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | ||
| 10466 | const src = inst_data.src(); | ||
| 10467 | const msg_inst = try sema.resolveInst(inst_data.operand); | ||
| 10468 | |||
| 10469 | const panic_fn = try sema.getBuiltin(block, src, "panic"); | ||
| 10470 | const err_return_trace = try sema.getErrorReturnTrace(block, src); | ||
| 10471 | const args: [3]Air.Inst.Ref = .{ msg_inst, err_return_trace, .null_value }; | ||
| 10472 | _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null); | ||
| 10473 | return true; | ||
| 10474 | }, | ||
| 10475 | else => unreachable, | ||
| 10476 | }; | ||
| 10477 | if (sema.typeOf(air_inst).isNoReturn()) | ||
| 10478 | return true; | ||
| 10479 | try sema.inst_map.put(sema.gpa, inst, air_inst); | ||
| 10480 | } | ||
| 10481 | unreachable; | ||
| 10482 | } | ||
| 10483 | |||
| 10484 | fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, cond: Zir.Inst.Ref, cond_src: LazySrcLoc) !void { | ||
| 10485 | const index = Zir.refToIndex(cond) orelse return; | ||
| 10486 | if (sema.code.instructions.items(.tag)[index] != .is_non_err) return; | ||
| 10487 | |||
| 10488 | const err_inst_data = sema.code.instructions.items(.data)[index].un_node; | ||
| 10489 | const err_operand = try sema.resolveInst(err_inst_data.operand); | ||
| 10490 | const operand_ty = sema.typeOf(err_operand); | ||
| 10491 | if (operand_ty.zigTypeTag() == .ErrorSet) { | ||
| 10492 | try sema.maybeErrorUnwrapComptime(block, body, err_operand); | ||
| 10493 | return; | ||
| 10494 | } | ||
| 10495 | if (try sema.resolveDefinedValue(block, cond_src, err_operand)) |val| { | ||
| 10496 | if (val.getError() == null) return; | ||
| 10497 | try sema.maybeErrorUnwrapComptime(block, body, err_operand); | ||
| 10498 | } | ||
| 10499 | } | ||
| 10500 | |||
| 10501 | fn maybeErrorUnwrapComptime(sema: *Sema, block: *Block, body: []const Zir.Inst.Index, operand: Air.Inst.Ref) !void { | ||
| 10502 | const tags = sema.code.instructions.items(.tag); | ||
| 10503 | const inst = for (body) |inst| { | ||
| 10504 | switch (tags[inst]) { | ||
| 10505 | .dbg_block_begin, | ||
| 10506 | .dbg_block_end, | ||
| 10507 | .dbg_stmt, | ||
| 10508 | => {}, | ||
| 10509 | .@"unreachable" => break inst, | ||
| 10510 | else => return, | ||
| 10511 | } | ||
| 10512 | } else return; | ||
| 10513 | const inst_data = sema.code.instructions.items(.data)[inst].@"unreachable"; | ||
| 10514 | const src = inst_data.src(); | ||
| 10515 | |||
| 10516 | if (try sema.resolveDefinedValue(block, src, operand)) |val| { | ||
| 10517 | if (val.getError()) |name| { | ||
| 10518 | return sema.fail(block, src, "caught unexpected error '{s}'", .{name}); | ||
| 10519 | } | ||
| 10520 | } | ||
| 10521 | } | ||
| 10522 | |||
| 10403 | fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 10523 | fn zirHasField(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| 10404 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; | 10524 | const inst_data = sema.code.instructions.items(.data)[inst].pl_node; |
| 10405 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 10525 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| ... | @@ -15152,6 +15272,8 @@ fn zirCondbr( | ... | @@ -15152,6 +15272,8 @@ fn zirCondbr( |
| 15152 | 15272 | ||
| 15153 | if (try sema.resolveDefinedValue(parent_block, cond_src, cond)) |cond_val| { | 15273 | if (try sema.resolveDefinedValue(parent_block, cond_src, cond)) |cond_val| { |
| 15154 | const body = if (cond_val.toBool()) then_body else else_body; | 15274 | const body = if (cond_val.toBool()) then_body else else_body; |
| 15275 | |||
| 15276 | try sema.maybeErrorUnwrapCondbr(parent_block, body, extra.data.condition, cond_src); | ||
| 15155 | // We use `analyzeBodyInner` since we want to propagate any possible | 15277 | // We use `analyzeBodyInner` since we want to propagate any possible |
| 15156 | // `error.ComptimeBreak` to the caller. | 15278 | // `error.ComptimeBreak` to the caller. |
| 15157 | return sema.analyzeBodyInner(parent_block, body); | 15279 | return sema.analyzeBodyInner(parent_block, body); |
| ... | @@ -15182,18 +15304,34 @@ fn zirCondbr( | ... | @@ -15182,18 +15304,34 @@ fn zirCondbr( |
| 15182 | const true_instructions = sub_block.instructions.toOwnedSlice(gpa); | 15304 | const true_instructions = sub_block.instructions.toOwnedSlice(gpa); |
| 15183 | defer gpa.free(true_instructions); | 15305 | defer gpa.free(true_instructions); |
| 15184 | 15306 | ||
| 15185 | _ = sema.analyzeBodyInner(&sub_block, else_body) catch |err| switch (err) { | 15307 | const err_cond = blk: { |
| 15186 | error.ComptimeBreak => { | 15308 | const index = Zir.refToIndex(extra.data.condition) orelse break :blk null; |
| 15187 | const zir_datas = sema.code.instructions.items(.data); | 15309 | if (sema.code.instructions.items(.tag)[index] != .is_non_err) break :blk null; |
| 15188 | const break_data = zir_datas[sema.comptime_break_inst].@"break"; | 15310 | |
| 15189 | try sema.addRuntimeBreak(&sub_block, .{ | 15311 | const err_inst_data = sema.code.instructions.items(.data)[index].un_node; |
| 15190 | .block_inst = break_data.block_inst, | 15312 | const err_operand = try sema.resolveInst(err_inst_data.operand); |
| 15191 | .operand = break_data.operand, | 15313 | const operand_ty = sema.typeOf(err_operand); |
| 15192 | .inst = sema.comptime_break_inst, | 15314 | assert(operand_ty.zigTypeTag() == .ErrorUnion); |
| 15193 | }); | 15315 | const result_ty = operand_ty.errorUnionSet(); |
| 15194 | }, | 15316 | break :blk try sub_block.addTyOp(.unwrap_errunion_err, result_ty, err_operand); |
| 15195 | else => |e| return e, | ||
| 15196 | }; | 15317 | }; |
| 15318 | |||
| 15319 | if (err_cond != null and try sema.maybeErrorUnwrap(&sub_block, else_body, err_cond.?)) { | ||
| 15320 | // nothing to do | ||
| 15321 | } else { | ||
| 15322 | _ = sema.analyzeBodyInner(&sub_block, else_body) catch |err| switch (err) { | ||
| 15323 | error.ComptimeBreak => { | ||
| 15324 | const zir_datas = sema.code.instructions.items(.data); | ||
| 15325 | const break_data = zir_datas[sema.comptime_break_inst].@"break"; | ||
| 15326 | try sema.addRuntimeBreak(&sub_block, .{ | ||
| 15327 | .block_inst = break_data.block_inst, | ||
| 15328 | .operand = break_data.operand, | ||
| 15329 | .inst = sema.comptime_break_inst, | ||
| 15330 | }); | ||
| 15331 | }, | ||
| 15332 | else => |e| return e, | ||
| 15333 | }; | ||
| 15334 | } | ||
| 15197 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len + | 15335 | try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len + |
| 15198 | true_instructions.len + sub_block.instructions.items.len); | 15336 | true_instructions.len + sub_block.instructions.items.len); |
| 15199 | _ = try parent_block.addInst(.{ | 15337 | _ = try parent_block.addInst(.{ |
| ... | @@ -21001,7 +21139,7 @@ fn panicWithMsg( | ... | @@ -21001,7 +21139,7 @@ fn panicWithMsg( |
| 21001 | try Type.optional(arena, ptr_stack_trace_ty), | 21139 | try Type.optional(arena, ptr_stack_trace_ty), |
| 21002 | Value.@"null", | 21140 | Value.@"null", |
| 21003 | ); | 21141 | ); |
| 21004 | const args: [2]Air.Inst.Ref = .{ msg_inst, null_stack_trace }; | 21142 | const args: [3]Air.Inst.Ref = .{ msg_inst, null_stack_trace, .null_value }; |
| 21005 | _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null); | 21143 | _ = try sema.analyzeCall(block, panic_fn, src, src, .auto, false, &args, null); |
| 21006 | return always_noreturn; | 21144 | return always_noreturn; |
| 21007 | } | 21145 | } |
src/Zir.zig-16| ... | @@ -629,20 +629,10 @@ pub const Inst = struct { | ... | @@ -629,20 +629,10 @@ pub const Inst = struct { |
| 629 | /// No safety checks. | 629 | /// No safety checks. |
| 630 | /// Uses the `un_node` field. | 630 | /// Uses the `un_node` field. |
| 631 | optional_payload_unsafe_ptr, | 631 | optional_payload_unsafe_ptr, |
| 632 | /// E!T => T with safety. | ||
| 633 | /// Given an error union value, returns the payload value, with a safety check | ||
| 634 | /// that the value is not an error. Used for catch, if, and while. | ||
| 635 | /// Uses the `un_node` field. | ||
| 636 | err_union_payload_safe, | ||
| 637 | /// E!T => T without safety. | 632 | /// E!T => T without safety. |
| 638 | /// Given an error union value, returns the payload value. No safety checks. | 633 | /// Given an error union value, returns the payload value. No safety checks. |
| 639 | /// Uses the `un_node` field. | 634 | /// Uses the `un_node` field. |
| 640 | err_union_payload_unsafe, | 635 | err_union_payload_unsafe, |
| 641 | /// *E!T => *T with safety. | ||
| 642 | /// Given a pointer to an error union value, returns a pointer to the payload value, | ||
| 643 | /// with a safety check that the value is not an error. Used for catch, if, and while. | ||
| 644 | /// Uses the `un_node` field. | ||
| 645 | err_union_payload_safe_ptr, | ||
| 646 | /// *E!T => *T without safety. | 636 | /// *E!T => *T without safety. |
| 647 | /// Given a pointer to a error union value, returns a pointer to the payload value. | 637 | /// Given a pointer to a error union value, returns a pointer to the payload value. |
| 648 | /// No safety checks. | 638 | /// No safety checks. |
| ... | @@ -1120,9 +1110,7 @@ pub const Inst = struct { | ... | @@ -1120,9 +1110,7 @@ pub const Inst = struct { |
| 1120 | .optional_payload_unsafe, | 1110 | .optional_payload_unsafe, |
| 1121 | .optional_payload_safe_ptr, | 1111 | .optional_payload_safe_ptr, |
| 1122 | .optional_payload_unsafe_ptr, | 1112 | .optional_payload_unsafe_ptr, |
| 1123 | .err_union_payload_safe, | ||
| 1124 | .err_union_payload_unsafe, | 1113 | .err_union_payload_unsafe, |
| 1125 | .err_union_payload_safe_ptr, | ||
| 1126 | .err_union_payload_unsafe_ptr, | 1114 | .err_union_payload_unsafe_ptr, |
| 1127 | .err_union_code, | 1115 | .err_union_code, |
| 1128 | .err_union_code_ptr, | 1116 | .err_union_code_ptr, |
| ... | @@ -1421,9 +1409,7 @@ pub const Inst = struct { | ... | @@ -1421,9 +1409,7 @@ pub const Inst = struct { |
| 1421 | .optional_payload_unsafe, | 1409 | .optional_payload_unsafe, |
| 1422 | .optional_payload_safe_ptr, | 1410 | .optional_payload_safe_ptr, |
| 1423 | .optional_payload_unsafe_ptr, | 1411 | .optional_payload_unsafe_ptr, |
| 1424 | .err_union_payload_safe, | ||
| 1425 | .err_union_payload_unsafe, | 1412 | .err_union_payload_unsafe, |
| 1426 | .err_union_payload_safe_ptr, | ||
| 1427 | .err_union_payload_unsafe_ptr, | 1413 | .err_union_payload_unsafe_ptr, |
| 1428 | .err_union_code, | 1414 | .err_union_code, |
| 1429 | .err_union_code_ptr, | 1415 | .err_union_code_ptr, |
| ... | @@ -1692,9 +1678,7 @@ pub const Inst = struct { | ... | @@ -1692,9 +1678,7 @@ pub const Inst = struct { |
| 1692 | .optional_payload_unsafe = .un_node, | 1678 | .optional_payload_unsafe = .un_node, |
| 1693 | .optional_payload_safe_ptr = .un_node, | 1679 | .optional_payload_safe_ptr = .un_node, |
| 1694 | .optional_payload_unsafe_ptr = .un_node, | 1680 | .optional_payload_unsafe_ptr = .un_node, |
| 1695 | .err_union_payload_safe = .un_node, | ||
| 1696 | .err_union_payload_unsafe = .un_node, | 1681 | .err_union_payload_unsafe = .un_node, |
| 1697 | .err_union_payload_safe_ptr = .un_node, | ||
| 1698 | .err_union_payload_unsafe_ptr = .un_node, | 1682 | .err_union_payload_unsafe_ptr = .un_node, |
| 1699 | .err_union_code = .un_node, | 1683 | .err_union_code = .un_node, |
| 1700 | .err_union_code_ptr = .un_node, | 1684 | .err_union_code_ptr = .un_node, |
src/crash_report.zig+2-2| ... | @@ -155,10 +155,10 @@ fn writeFullyQualifiedDeclWithFile(mod: *Module, decl: *Decl, stream: anytype) ! | ... | @@ -155,10 +155,10 @@ fn writeFullyQualifiedDeclWithFile(mod: *Module, decl: *Decl, stream: anytype) ! |
| 155 | try decl.renderFullyQualifiedDebugName(mod, stream); | 155 | try decl.renderFullyQualifiedDebugName(mod, stream); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | pub fn compilerPanic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { | 158 | pub fn compilerPanic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, maybe_ret_addr: ?usize) noreturn { |
| 159 | PanicSwitch.preDispatch(); | 159 | PanicSwitch.preDispatch(); |
| 160 | @setCold(true); | 160 | @setCold(true); |
| 161 | const ret_addr = @returnAddress(); | 161 | const ret_addr = maybe_ret_addr orelse @returnAddress(); |
| 162 | const stack_ctx: StackContext = .{ .current = .{ .ret_addr = ret_addr } }; | 162 | const stack_ctx: StackContext = .{ .current = .{ .ret_addr = ret_addr } }; |
| 163 | PanicSwitch.dispatch(error_return_trace, stack_ctx, msg); | 163 | PanicSwitch.dispatch(error_return_trace, stack_ctx, msg); |
| 164 | } | 164 | } |
src/print_zir.zig-2| ... | @@ -170,9 +170,7 @@ const Writer = struct { | ... | @@ -170,9 +170,7 @@ const Writer = struct { |
| 170 | .optional_payload_unsafe, | 170 | .optional_payload_unsafe, |
| 171 | .optional_payload_safe_ptr, | 171 | .optional_payload_safe_ptr, |
| 172 | .optional_payload_unsafe_ptr, | 172 | .optional_payload_unsafe_ptr, |
| 173 | .err_union_payload_safe, | ||
| 174 | .err_union_payload_unsafe, | 173 | .err_union_payload_unsafe, |
| 175 | .err_union_payload_safe_ptr, | ||
| 176 | .err_union_payload_unsafe_ptr, | 174 | .err_union_payload_unsafe_ptr, |
| 177 | .err_union_code, | 175 | .err_union_code, |
| 178 | .err_union_code_ptr, | 176 | .err_union_code_ptr, |
src/stage1/codegen.cpp+13-1| ... | @@ -1086,11 +1086,23 @@ static void gen_panic(CodeGen *g, LLVMValueRef msg_arg, LLVMValueRef stack_trace | ... | @@ -1086,11 +1086,23 @@ static void gen_panic(CodeGen *g, LLVMValueRef msg_arg, LLVMValueRef stack_trace |
| 1086 | if (stack_trace_arg == nullptr) { | 1086 | if (stack_trace_arg == nullptr) { |
| 1087 | stack_trace_arg = LLVMConstNull(get_llvm_type(g, ptr_to_stack_trace_type(g))); | 1087 | stack_trace_arg = LLVMConstNull(get_llvm_type(g, ptr_to_stack_trace_type(g))); |
| 1088 | } | 1088 | } |
| 1089 | LLVMValueRef null_ret_alloc; | ||
| 1090 | { | ||
| 1091 | ZigValue null_val = {}; | ||
| 1092 | null_val.special = ConstValSpecialStatic; | ||
| 1093 | null_val.data.x_optional = nullptr; | ||
| 1094 | null_val.type = get_optional_type2(g, g->builtin_types.entry_usize); | ||
| 1095 | LLVMValueRef null_ret_val = gen_const_val(g, &null_val, ""); | ||
| 1096 | null_ret_alloc = build_alloca(g, null_val.type, "ret_addr", 0); | ||
| 1097 | LLVMBuildStore(g->builder, null_ret_val, null_ret_alloc); | ||
| 1098 | } | ||
| 1099 | |||
| 1089 | LLVMValueRef args[] = { | 1100 | LLVMValueRef args[] = { |
| 1090 | msg_arg, | 1101 | msg_arg, |
| 1091 | stack_trace_arg, | 1102 | stack_trace_arg, |
| 1103 | null_ret_alloc, | ||
| 1092 | }; | 1104 | }; |
| 1093 | ZigLLVMBuildCall(g->builder, LLVMGlobalGetValueType(fn_val), fn_val, args, 2, llvm_cc, ZigLLVM_CallAttrAuto, ""); | 1105 | ZigLLVMBuildCall(g->builder, LLVMGlobalGetValueType(fn_val), fn_val, args, 3, llvm_cc, ZigLLVM_CallAttrAuto, ""); |
| 1094 | if (!stack_trace_is_llvm_alloca) { | 1106 | if (!stack_trace_is_llvm_alloca) { |
| 1095 | // The stack trace argument is not in the stack of the caller, so | 1107 | // The stack trace argument is not in the stack of the caller, so |
| 1096 | // we'd like to set tail call here, but because slices (the type of msg_arg) are | 1108 | // we'd like to set tail call here, but because slices (the type of msg_arg) are |
test/cases/compile_errors/stage1/obj/wrong_panic_signature_generic_function.zig+2-2| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn { | 1 | pub fn panic(comptime msg: []const u8, error_return_trace: ?*builtin.StackTrace, _: ?usize) noreturn { |
| 2 | _ = msg; _ = error_return_trace; | 2 | _ = msg; _ = error_return_trace; |
| 3 | while (true) {} | 3 | while (true) {} |
| 4 | } | 4 | } |
| ... | @@ -8,5 +8,5 @@ const builtin = @import("std").builtin; | ... | @@ -8,5 +8,5 @@ const builtin = @import("std").builtin; |
| 8 | // backend=stage1 | 8 | // backend=stage1 |
| 9 | // target=native | 9 | // target=native |
| 10 | // | 10 | // |
| 11 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn([]const u8,anytype) anytype' | 11 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace, ?usize) noreturn', found 'fn([]const u8,anytype,anytype) anytype' |
| 12 | // note: only one of the functions is generic | 12 | // note: only one of the functions is generic |
test/cases/compile_errors/stage1/obj/wrong_panic_signature_runtime_function.zig+1-1| ... | @@ -7,4 +7,4 @@ pub fn panic() void {} | ... | @@ -7,4 +7,4 @@ pub fn panic() void {} |
| 7 | // backend=stage1 | 7 | // backend=stage1 |
| 8 | // target=native | 8 | // target=native |
| 9 | // | 9 | // |
| 10 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace) noreturn', found 'fn() void' | 10 | // error: expected type 'fn([]const u8, ?*std.builtin.StackTrace, ?usize) noreturn', found 'fn() void' |
test/cases/safety/@alignCast misaligned.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@asyncCall with too small a frame.zig	+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | 3 | ||
| 4 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 4 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 5 | _ = message; | 5 | _ = message; |
| 6 | _ = stack_trace; | 6 | _ = stack_trace; |
| 7 | std.process.exit(0); | 7 | std.process.exit(0); |
test/cases/safety/@errSetCast error not present in destination.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@floatToInt cannot fit - negative out of range.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@floatToInt cannot fit - negative to unsigned.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@floatToInt cannot fit - positive out of range.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@intCast to u0.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { | 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { |
| 6 | std.process.exit(0); | 6 | std.process.exit(0); |
test/cases/safety/@intToEnum - no matching tag value.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@intToPtr address zero to non-optional byte-aligned pointer.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@intToPtr address zero to non-optional pointer.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/@tagName on corrupted enum value.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 non-scalar.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "sentinel mismatch: expected tmp.main.S{ .a = 1 }, found tmp.main.S{ .a = 2 }")) { | 5 | if (std.mem.eql(u8, message, "sentinel mismatch: expected tmp.main.S{ .a = 1 }, found tmp.main.S{ .a = 2 }")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/awaiting twice.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = message; | 4 | _ = message; |
| 5 | _ = stack_trace; | 5 | _ = stack_trace; |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "access of inactive union field")) { | 5 | if (std.mem.eql(u8, message, "access of inactive union field")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/error return trace across suspend points.zig	+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 4 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 5 | _ = message; | 5 | _ = message; |
| 6 | _ = stack_trace; | 6 | _ = stack_trace; |
| 7 | std.process.exit(0); | 7 | std.process.exit(0); |
test/cases/safety/exact division failure - vectors.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/intToPtr with misaligned address.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/integer addition overflow.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/invalid resume of async function.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = message; | 4 | _ = message; |
| 5 | _ = stack_trace; | 5 | _ = stack_trace; |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/nosuspend function call, callee suspends.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = message; | 4 | _ = message; |
| 5 | _ = stack_trace; | 5 | _ = stack_trace; |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/out of bounds slice access.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/resuming a function which is awaiting a call.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = message; | 4 | _ = message; |
| 5 | _ = stack_trace; | 5 | _ = stack_trace; |
| 6 | std.process.exit(0); | 6 | std.process.exit(0); |
test/cases/safety/resuming a function which is awaiting a frame.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = message; | 4 | _ = message; |
| 5 | _ = stack_trace; | 5 | _ = stack_trace; |
| 6 | std.process.exit(0); | 6 | std.process.exit(0); |
test/cases/safety/resuming a non-suspended function which has been suspended and resumed.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = message; | 4 | _ = message; |
| 5 | _ = stack_trace; | 5 | _ = stack_trace; |
| 6 | std.process.exit(0); | 6 | std.process.exit(0); |
test/cases/safety/resuming a non-suspended function which never been suspended.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = message; | 4 | _ = message; |
| 5 | _ = stack_trace; | 5 | _ = stack_trace; |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) { | 5 | if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) { | 5 | if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) { | 5 | if (std.mem.eql(u8, message, "attempt to cast negative value to unsigned integer")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "sentinel mismatch: expected 1.20000004e+00, found 4.0e+00")) { | 5 | if (std.mem.eql(u8, message, "sentinel mismatch: expected 1.20000004e+00, found 4.0e+00")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 with sentinel out of bounds - runtime len.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/slicing null C pointer - runtime len.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 on corrupted enum value.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { | 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { | 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { | 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { |
| 6 | std.process.exit(0); | 6 | std.process.exit(0); |
test/cases/safety/unwrap error switch.zig	 created+21| ... | @@ -0,0 +1,21 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "attempt to unwrap error: Whatever")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | bar() catch |err| switch (err) { | ||
| 12 | error.Whatever => unreachable, | ||
| 13 | }; | ||
| 14 | return error.TestFailed; | ||
| 15 | } | ||
| 16 | fn bar() !void { | ||
| 17 | return error.Whatever; | ||
| 18 | } | ||
| 19 | // run | ||
| 20 | // backend=llvm | ||
| 21 | // target=native | ||
test/cases/safety/unwrap error.zig	+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { | 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { | 5 | if (std.mem.eql(u8, message, "integer cast truncated bits")) { |
| 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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.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/cli.zig+1-1| ... | @@ -120,7 +120,7 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void { | ... | @@ -120,7 +120,7 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void { |
| 120 | \\ return num * num; | 120 | \\ return num * num; |
| 121 | \\} | 121 | \\} |
| 122 | \\extern fn zig_panic() noreturn; | 122 | \\extern fn zig_panic() noreturn; |
| 123 | \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace) noreturn { | 123 | \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn { |
| 124 | \\ _ = msg; | 124 | \\ _ = msg; |
| 125 | \\ _ = error_return_trace; | 125 | \\ _ = error_return_trace; |
| 126 | \\ zig_panic(); | 126 | \\ zig_panic(); |
test/standalone/issue_339/test.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const StackTrace = @import("std").builtin.StackTrace; | 1 | const StackTrace = @import("std").builtin.StackTrace; |
| 2 | pub fn panic(msg: []const u8, stack_trace: ?*StackTrace) noreturn { | 2 | pub fn panic(msg: []const u8, stack_trace: ?*StackTrace, _: ?usize) noreturn { |
| 3 | _ = msg; | 3 | _ = msg; |
| 4 | _ = stack_trace; | 4 | _ = stack_trace; |
| 5 | @breakpoint(); | 5 | @breakpoint(); |
test/standalone/issue_8550/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 matter | 5 | unreachable; // never gets run so it doesn't matter |
| 6 | } | 6 | } |
| 7 | pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace) noreturn { | 7 | pub fn panic(msg: []const u8, error_return_trace: ?*@import("std").builtin.StackTrace, _: ?usize) noreturn { |
| 8 | _ = msg; | 8 | _ = msg; |
| 9 | _ = error_return_trace; | 9 | _ = error_return_trace; |
| 10 | while (true) {} | 10 | while (true) {} |