authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-26 16:46:02-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-26 16:46:02-07:00
logdb8c0744767b3d472f9682827a312a8ffed74adf
treebc3c246a0f2bad79600970a20bcfd98bc42e7e12
parent1b491e640d7c6a3cd71c4b146ca104ff0b136edd

fix still calling std.builtin.panic sometimes


3 files changed, 5 insertions(+), 4 deletions(-)

lib/std/builtin.zig+1-1
......@@ -770,7 +770,7 @@ pub const panic: PanicFn = if (@hasDecl(root, "panic"))
770770else if (@hasDecl(root, "os") and @hasDecl(root.os, "panic"))
771771 root.os.panic
772772else
773 std.debug.defaultPanic;
773 Panic.call;
774774
775775/// This namespace is used by the Zig compiler to emit various kinds of safety
776776/// panics. These can be overridden by making a public `Panic` namespace in the
src/Sema.zig+1-1
......@@ -27639,7 +27639,7 @@ fn prepareSimplePanic(sema: *Sema, block: *Block, src: LazySrcLoc) !void {
2763927639 const zcu = pt.zcu;
2764027640
2764127641 if (zcu.panic_func_index == .none) {
27642 const fn_ref = try sema.analyzeNavVal(block, src, try pt.getBuiltinNav("panic"));
27642 const fn_ref = try sema.getBuiltinInnerAsInst(block, src, "Panic", "call");
2764327643 const fn_val = try sema.resolveConstValue(block, src, fn_ref, .{
2764427644 .needed_comptime_reason = "panic handler must be comptime-known",
2764527645 });
src/Zcu.zig+3-2
......@@ -2918,8 +2918,9 @@ pub fn addGlobalAssembly(zcu: *Zcu, cau: InternPool.Cau.Index, source: []const u
29182918}
29192919
29202920pub const Feature = enum {
2921 /// When this feature is enabled, Sema will emit calls to `std.builtin.panic`
2922 /// for things like safety checks and unreachables. Otherwise traps will be emitted.
2921 /// When this feature is enabled, Sema will emit calls to
2922 /// `std.builtin.Panic` functions for things like safety checks and
2923 /// unreachables. Otherwise traps will be emitted.
29232924 panic_fn,
29242925 /// When this feature is enabled, Sema will insert tracer functions for gathering a stack
29252926 /// trace for error returns.