Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace non-mutated vars with const #1997

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Replace non-mutated vars with const #1997

merged 2 commits into from
Jun 10, 2024

Conversation

kprotty
Copy link
Contributor

@kprotty kprotty commented Jun 10, 2024

In preparation for the Zig 0.13 upgrade as the change is 1) compatible with 0.11 and 2) allows more careful review of vars which should've been mutated.

@matklad
Copy link
Member

matklad commented Jun 10, 2024

LGTM!

It's interesting that a bunch of these are for pointers: that is, we tend to write

var foo: *Foo = allocator.create(Foo)

when we intend to write Foo, but this needs to be const, because we are not going to mutate the pointer itself!

@kprotty kprotty added this pull request to the merge queue Jun 10, 2024
Merged via the queue into main with commit 21b509c Jun 10, 2024
25 checks passed
@kprotty kprotty deleted the king/var-to-const branch June 10, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants