authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-01-22 01:51:55+00:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2025-01-22 02:22:56-05:00
log9b7b240c8e4757bf0119db70da30722aa97fd6ae
tree8c8c8c41a730420b6ab62b48a9c8560bb735137c
parent8b5c4baed8aa99612734b763ecb1fa0364dc7940

std.builtin: make `returnError` not take the error trace

It's now unnecessary to explicitly pass this, because it receives an implicit error trace parameter anyway, so can just use `@errorReturnTrace()`. The previous commit updated Sema to expect this new interface. This saves an AIR instruction at all `returnError` call sites.

1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/builtin.zig+2-1
...@@ -1150,9 +1150,10 @@ pub const panicInactiveUnionField = Panic.inactiveUnionField;...@@ -1150,9 +1150,10 @@ pub const panicInactiveUnionField = Panic.inactiveUnionField;
1150/// To be deleted after zig1.wasm is updated.1150/// To be deleted after zig1.wasm is updated.
1151pub const panic_messages = Panic.messages;1151pub const panic_messages = Panic.messages;
11521152
1153pub noinline fn returnError(st: *StackTrace) void {1153pub noinline fn returnError() void {
1154 @branchHint(.unlikely);1154 @branchHint(.unlikely);
1155 @setRuntimeSafety(false);1155 @setRuntimeSafety(false);
1156 const st = @errorReturnTrace().?;
1156 if (st.index < st.instruction_addresses.len)1157 if (st.index < st.instruction_addresses.len)
1157 st.instruction_addresses[st.index] = @returnAddress();1158 st.instruction_addresses[st.index] = @returnAddress();
1158 st.index += 1;1159 st.index += 1;