@@ -2024,7 +2024,7 @@ fn resolveConstString(
20242024 block: *Block,
20252025 src: LazySrcLoc,
20262026 zir_ref: Zir.Inst.Ref,
2027- reason: ComptimeReason,
2027+ reason: ? ComptimeReason,
20282028) ![]u8 {
20292029 const air_inst = try sema.resolveInst(zir_ref);
20302030 return sema.toConstString(block, src, air_inst, reason);
@@ -2035,7 +2035,7 @@ pub fn toConstString(
20352035 block: *Block,
20362036 src: LazySrcLoc,
20372037 air_inst: Air.Inst.Ref,
2038- reason: ComptimeReason,
2038+ reason: ? ComptimeReason,
20392039) ![]u8 {
20402040 const pt = sema.pt;
20412041 const coerced_inst = try sema.coerce(block, .slice_const_u8, air_inst, src);
@@ -5569,10 +5569,12 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
55695569 const src = block.nodeOffset(inst_data.src_node);
55705570 const msg_inst = try sema.resolveInst(inst_data.operand);
55715571
5572- const coerced_msg = try sema.coerce(block, .slice_const_u8, msg_inst, block.builtinCallArgSrc(inst_data.src_node, 0));
5572+ const arg_src = block.builtinCallArgSrc(inst_data.src_node, 0);
5573+ const coerced_msg = try sema.coerce(block, .slice_const_u8, msg_inst, arg_src);
55735574
55745575 if (block.isComptime()) {
5575- return sema.fail(block, src, "encountered @panic at comptime", .{});
5576+ const string = try sema.resolveConstString(block, arg_src, inst_data.operand, null);
5577+ return sema.fail(block, src, "encountered @panic at comptime: {s}", .{string});
55765578 }
55775579
55785580 // We only apply the first hint in a branch.
@@ -37261,7 +37263,7 @@ fn derefSliceAsArray(
3726137263 block: *Block,
3726237264 src: LazySrcLoc,
3726337265 slice_val: Value,
37264- reason: ComptimeReason,
37266+ reason: ? ComptimeReason,
3726537267) CompileError!Value {
3726637268 return try sema.maybeDerefSliceAsArray(block, src, slice_val) orelse {
3726737269 return sema.failWithNeededComptime(block, src, reason);
0 commit comments