# compiler: fix crash if file contents change during update · gitcafe/zig

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

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

Visibility: public

Requested revision: 806470b492f15c4e3350ce4a48e607f2c8e94ff8

Requested commit: 806470b492f15c4e3350ce4a48e607f2c8e94ff8

Commit: 806470b492f15c4e3350ce4a48e607f2c8e94ff8

Tree: 3bbc7184dc62cc4f1e583c9e907620517f44e4c7

Author: Matthew Lugg

Committer: Matthew Lugg

## Message

```
compiler: fix crash if file contents change during update

When reporting a compile error, we would load the new file, but assume
we could apply old AST/token indices (etc) to it, potentially causing
crashes. Instead, if the file stat has changed since it was loaded, just
emit an error that the file was modified mid-update.

```

## Parents

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

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