# Zcu: store \`LazySrcLoc\` in error messages · gitcafe/zig

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

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

Visibility: public

Requested revision: ded5c759f83a4da355a128dd4d7f5e22cbd3cabe

Requested commit: ded5c759f83a4da355a128dd4d7f5e22cbd3cabe

Commit: ded5c759f83a4da355a128dd4d7f5e22cbd3cabe

Tree: b862bbdf36b892e9c39f472c6759f084c87d64b2

Author: mlugg

Committer: mlugg

## Message

```
Zcu: store `LazySrcLoc` in error messages

This change modifies `Zcu.ErrorMsg` to store a `Zcu.LazySrcLoc` rather
than a `Zcu.SrcLoc`. Everything else is dominoes.

The reason for this change is incremental compilation. If a failed
`AnalUnit` is up-to-date on an update, we want to re-use the old error
messages. However, the file containing the error location may have been
modified, and `SrcLoc` cannot survive such a modification. `LazySrcLoc`
is designed to be correct across incremental updates. Therefore, we
defer source location resolution until `Compilation` gathers the compile
errors into the `ErrorBundle`.

```

## Parents

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

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