Skip to content

Port zig-interface to Zig 0.17 - #12

Merged
nilslice merged 4 commits into
mainfrom
cursor/zig-0.17-aa6e
Oct 7, 2026
Merged

nilslice merged 4 commits into
mainfrom
cursor/zig-0.17-aa6e

Conversation

@nilslice

@nilslice nilslice commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Updates the library for Zig 0.17.0’s struct-of-arrays type reflection, and stops reflecting a finished vtable to copy it into a parent.

src/interface.zig now:

  • reads struct, enum, pointer, and function info from field_names / field_types / field_values / param_types / attrs
  • builds each vtable once from the method spec, prepending *anyopaque in that build
  • embeds another interface by reusing that interface’s vtable_field_names and vtable_field_types, rather than @typeInfo on its generated VTable
  • uses @backingInt and builtin.target.os

test/vtable.zig reads the generated vtable’s field names with @typeInfo(VTableType).@"struct".field_names instead of std.meta.fields.

Interface declarations stay fn (User) anyerror!u32. Call sites stay repo.vtable.create(repo.ptr, user).

minimum_zig_version is 0.17.0. The README and CI say the same thing the 0.16 port said for its compiler: Requires Zig 0.17+. Older Zig versions should depend on a pinned 0.16- or 0.15-compatible release. CI tests Zig 0.17.0.

Verification

zig build test with Zig 0.17.0: 15/15 steps succeeded, 28/28 tests passed.

Open in Web Open in Cursor 

cursoragent and others added 4 commits October 7, 2026 21:27
Replace removed StructField and std.meta.fields usage with the
struct-of-arrays @typeinfo layout, and require Zig 0.17.0.

Co-authored-by: Steve Manuel <[email protected]>
std.meta.fields is a compile error on Zig 0.17.

Co-authored-by: Steve Manuel <[email protected]>
Embedding and wrapper generation reuse those arrays instead of
reflecting the finished vtable struct.

Co-authored-by: Steve Manuel <[email protected]>
Builds against 0.16 or 0.15 should use a pinned compatible release.

Co-authored-by: Steve Manuel <[email protected]>
@nilslice
nilslice marked this pull request as ready for review October 7, 2026 22:02
@nilslice
nilslice merged commit d521b41 into main Oct 7, 2026
3 checks passed
@nilslice
nilslice deleted the cursor/zig-0.17-aa6e branch October 7, 2026 22:04
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