diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2025-01-22 01:51:55 +0000 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-01-22 02:22:56 -0500 |
| commit | 9b7b240c8e4757bf0119db70da30722aa97fd6ae (patch) | |
| tree | 8c8c8c41a730420b6ab62b48a9c8560bb735137c /lib/std/builtin.zig | |
| parent | 8b5c4baed8aa99612734b763ecb1fa0364dc7940 (diff) | |
| download | zig-9b7b240c8e4757bf0119db70da30722aa97fd6ae.tar.gz zig-9b7b240c8e4757bf0119db70da30722aa97fd6ae.zip | |
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 (limited to 'lib/std/builtin.zig')
| -rw-r--r-- | lib/std/builtin.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 763db8448c..73a47fa3af 100644 --- 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; |
