Skip to content

Commit 241d88f

Browse files
authored
Merge pull request #253 from Snektron/zig-0.17-meta-changes
update to zig 0.17 836
2 parents b496a6a + 2331c14 commit 241d88f

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.name = .vulkan,
33
.fingerprint = 0xbe155a03c72db6af,
44
.version = "0.0.0",
5-
.minimum_zig_version = "0.16.0",
5+
.minimum_zig_version = "0.17.0-dev.836+e357134f0",
66
.paths = .{
77
"build.zig.zon",
88
"build.zig",

src/vulkan/render.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,9 +1569,9 @@ const Renderer = struct {
15691569
try self.writer.print(
15701570
\\pub fn load({[params]s}) Self {{
15711571
\\ var self: Self = .{{ .dispatch = .{{}} }};
1572-
\\ inline for (std.meta.fields(Dispatch)) |field| {{
1573-
\\ if (loader({[first_arg]s}, field.name.ptr)) |cmd_ptr| {{
1574-
\\ @field(self.dispatch, field.name) = @ptrCast(cmd_ptr);
1572+
\\ inline for (@typeInfo(Dispatch).@"struct".field_names) |field| {{
1573+
\\ if (loader({[first_arg]s}, field.ptr)) |cmd_ptr| {{
1574+
\\ @field(self.dispatch, field) = @ptrCast(cmd_ptr);
15751575
\\ }}
15761576
\\ }}
15771577
\\ return self;

test/ref_all_decls.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ comptime {
9999

100100
fn reallyRefAllDecls(comptime T: type) void {
101101
switch (@typeInfo(T)) {
102-
.@"struct", .@"union" => {
102+
inline .@"struct", .@"union" => |info| {
103103
reallyRefAllContainerDecls(T);
104-
inline for (std.meta.fields(T)) |field| {
105-
reallyRefAllDecls(field.type);
104+
inline for (info.field_types) |field_ty| {
105+
reallyRefAllDecls(field_ty);
106106
}
107107
},
108108
.@"enum", .@"opaque" => {
@@ -114,8 +114,8 @@ fn reallyRefAllDecls(comptime T: type) void {
114114

115115
fn reallyRefAllContainerDecls(comptime T: type) void {
116116
inline for (comptime std.meta.declarations(T)) |decl| {
117-
if (@TypeOf(@field(T, decl.name)) == type) {
118-
reallyRefAllDecls(@field(T, decl.name));
117+
if (@TypeOf(@field(T, decl)) == type) {
118+
reallyRefAllDecls(@field(T, decl));
119119
}
120120
}
121121
}

0 commit comments

Comments
 (0)