# stage2: implement error wrapping · gitcafe/zig

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

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

Visibility: public

Requested revision: 6534f2ef4f8161f4121326f19bc3cf89324f62c5

Requested commit: 6534f2ef4f8161f4121326f19bc3cf89324f62c5

Commit: 6534f2ef4f8161f4121326f19bc3cf89324f62c5

Tree: 87fb9d6f2b082a534402080f53febf483d81e7fc

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: implement error wrapping

 * Sema: fix returned operands not coercing to the function return type
   in some cases.
   - When returning an error or an error union from a function with an
     inferred error set, it will now populate the inferred error set.
   - Implement error set coercion for the common case of inferred error
     set to inferred error set, without forcing a full resolution.
 * LLVM backend: update instruction lowering that handles error unions
   to respect `isByRef`.
   - Also implement `wrap_err_union_err`.

```

## Parents

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

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