| ... | ... | @@ -5671,10 +5671,14 @@ fn zirPanic(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Zir.I |
| 5671 | 5671 | const src = inst_data.src(); |
| 5672 | 5672 | const msg_inst = try sema.resolveInst(inst_data.operand); |
| 5673 | 5673 | |
| 5674 | // `panicWithMsg` would perform this coercion for us, but we can get a better |
| 5675 | // source location if we do it here. |
| 5676 | const coerced_msg = try sema.coerce(block, Type.slice_const_u8, msg_inst, .{ .node_offset_builtin_call_arg0 = inst_data.src_node }); |
| 5677 | |
| 5674 | 5678 | if (block.is_comptime) { |
| 5675 | 5679 | return sema.fail(block, src, "encountered @panic at comptime", .{}); |
| 5676 | 5680 | } |
| 5677 | | try sema.panicWithMsg(block, src, msg_inst, .@"@panic"); |
| 5681 | try sema.panicWithMsg(block, src, coerced_msg, .@"@panic"); |
| 5678 | 5682 | return always_noreturn; |
| 5679 | 5683 | } |
| 5680 | 5684 | |