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

Update all references std.builtin.Type, usually via @typeInfo, to following Zig naming conventions #2

Merged
merged 4 commits into from
Dec 12, 2024

Conversation

jules-sommer
Copy link
Contributor

The following breaking change was merged in this Zig PR: ziglang/zig#21225 which means that on newer Zig versions all references to std.builtin.Type have to be updated to correctly reflect that, an example:

// new format matching naming conventions:
const type_info = @typeInfo(T);
const fields = type_info.@"struct".fields;

// previous to PR#21225
const type_info = @typeInfo(T);
const fields = type_info.Struct.fields;

I am on Zig version: v0.14.0-dev.2270+a5d4ad17b but older versions will also run into compiler errors. Not sure exactly where that PR ended up in relation to semver. Either way, I ran into it and the change was easy enough I figured I'd quickly submit this PR.

test
└─ run test
   └─ zig test Debug native 7 errors
src/float.zig:35:23: error: no field named 'Float' in union 'builtin.Type'
    switch (type_info.Float.bits) {
                      ^~~~~

tests are passing on my machine, but if anything is wrong or needs changing feel free to reply/edit. 😄

~ Jules

@lalinsky
Copy link
Owner

Thank you for this, I'll create a branch for zig 0.13 and then merge it.

@lalinsky lalinsky merged commit 3a2978f into lalinsky:main Dec 12, 2024
1 check failed
@jules-sommer
Copy link
Contributor Author

Thank you for this, I'll create a branch for zig 0.13 and then merge it.

of course! glad it was helpful. ❤️

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