# astgen: const locals that end up being rvalues do not alloc · gitcafe/zig

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

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

Visibility: public

Requested revision: 2f992e1bb3ff0beb01bd7763a7937000a88f445e

Requested commit: 2f992e1bb3ff0beb01bd7763a7937000a88f445e

Commit: 2f992e1bb3ff0beb01bd7763a7937000a88f445e

Tree: 2de8db279cda9d5f38d3c54e5b92534b7796e7b9

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
astgen: const locals that end up being rvalues do not alloc

Local variable declarations now detect whether the result location for the
initialization expression consumes the result location as a pointer. If
it does, then the local is emitted as a LocalPtr. Otherwise it is
emitted as a LocalVal.

This results in clean, straightforward ZIR code for semantic analysis.

```

## Parents

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

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