# stage2: Add \`\.save_err_return_trace_index\` AIR op · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/724d75363855176aa5e6b3d9bcd1656e2cc1f6a6)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 724d75363855176aa5e6b3d9bcd1656e2cc1f6a6

Requested commit: 724d75363855176aa5e6b3d9bcd1656e2cc1f6a6

Commit: 724d75363855176aa5e6b3d9bcd1656e2cc1f6a6

Tree: f3b5c2e68dcc355ade60e3c75065002715040790

Author: Cody Tapscott

Committer: Cody Tapscott

## Message

```
stage2: Add `.save_err_return_trace_index` AIR op

This is encoded as a primitive AIR instruction to resolve one corner
case: A function may include a `catch { ... }` or `else |err| { ... }`
block but not call any errorable fn. In that case, there is no error
return trace to save the index of and codegen needs to avoid
interacting with the non-existing error trace.

By using a primitive AIR op, we can depend on Liveness to mark this
unused in this corner case.

```

## Parents

- [3007fdde45868142654d0bfa59bc0e17e5f24a1c](https://git.cafe/gitcafe/zig/commit/3007fdde45868142654d0bfa59bc0e17e5f24a1c?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/724d75363855176aa5e6b3d9bcd1656e2cc1f6a6?format=markdown)
