commit 9b7b240c8e4757bf0119db70da30722aa97fd6ae (tree)
parent 8b5c4baed8aa99612734b763ecb1fa0364dc7940
Author: mlugg <mlugg@mlugg.co.uk>
Date: Wed, 22 Jan 2025 01:51:55 +0000
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.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/std/builtin.zig b/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;