# async functions have error return traces where appropriate · gitcafe/zig

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

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

Visibility: public

Requested revision: 20f63e588e62c4a7250bc96c9e5b54c8106ad1af

Requested commit: 20f63e588e62c4a7250bc96c9e5b54c8106ad1af

Commit: 20f63e588e62c4a7250bc96c9e5b54c8106ad1af

Tree: bc138766dfe7938b12891e3856e2cab3a4eece26

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
async functions have error return traces where appropriate

however the traces are not merged on `await` or async function calls
yet.

When an async function has an error set or error union as its return
type, it has a `StackTrace` before the args in the frame, so that it is
accessible from `anyframe->T` awaiters. However when it does not have an
errorable return type, but it does call or await an errorable, it has a
stack trace just before the locals. This way when doing an `@asyncCall`
on an async function pointer, it can populate the args (which are after
the `StackTrace`) because it knows the offset of the args based only on
the return type.

This sort of matches normal functions, where a stack trace pointer could
be supplied by a parameter, or it could be supplied by the stack of the
function, depending on whether the function itself is errorable.

```

## Parents

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

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