# Zcu: use shortest reference trace · gitcafe/zig

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

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

Visibility: public

Requested revision: 8907dc8a4fbec951e4a4d3266aded9d751f07c4e

Requested commit: 8907dc8a4fbec951e4a4d3266aded9d751f07c4e

Commit: 8907dc8a4fbec951e4a4d3266aded9d751f07c4e

Tree: 0f17d870bde7af4438d1f93ee11fcd904713e204

Author: Matthew Lugg

Committer: Matthew Lugg

## Message

```
Zcu: use shortest reference trace

The logic for computing reference traces was unintentionally finding the
*longest* possible trace (approximately). I think I already tried to fix
this before, but misunderstood how my own code works. Here, we fix it
properly: by slightly reworking the logic to use one ArrayHashMap for
both the result and the traversal queue, we trivially get a proper
breadth-first traversal so that we can find the shortest possible
reference trace for every referenced unit.

```

## Parents

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

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