Commit 9b7b240c8e

mlugg <mlugg@mlugg.co.uk>
2025-01-22 02:51:55
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 parent 8b5c4ba
Changed files (1)
lib
lib/std/builtin.zig
@@ -1150,9 +1150,10 @@ pub const panicInactiveUnionField = Panic.inactiveUnionField;
 /// To be deleted after zig1.wasm is updated.
 pub const panic_messages = Panic.messages;
 
-pub noinline fn returnError(st: *StackTrace) void {
+pub noinline fn returnError() void {
     @branchHint(.unlikely);
     @setRuntimeSafety(false);
+    const st = @errorReturnTrace().?;
     if (st.index < st.instruction_addresses.len)
         st.instruction_addresses[st.index] = @returnAddress();
     st.index += 1;