Skip to content

Support Zig 0.17.0 - #2

Open
kalpakprod wants to merge 1 commit into
muhammad-fiaz:mainfrom
kalpakprod:fix/zig-0.17-compat
Open

kalpakprod wants to merge 1 commit into
muhammad-fiaz:mainfrom
kalpakprod:fix/zig-0.17-compat

Conversation

@kalpakprod

Copy link
Copy Markdown

Description

Makes the library, its test suite and the examples build and pass on the released Zig 0.17.0 (today zig build stops at five parser errors, and after those are fixed a further 141 compile diagnostics remain).

What changed:

  • Struct reflection: std.builtin.Type.Struct.fields no longer exists in 0.17 (field_names / field_types / field_attrs replace it). All 53 uses in dsl/ and connection/ go through one small helper, src/compat.zig (compat.fields(info)), which rebuilds the old name/type/default/comptime view. No DSL logic changed. The function-parameter reflection site in dsl/table.zig moved from .params to .param_types; two StructField.Attributes spellings became Struct.FieldAttributes.
  • Array repetition: the five [_]u8{0} ** N-style expressions (btree.zig, dsl/keys.zig, dsl/table.zig, storage/wal.zig, vm/vm.zig) plus a few test-only ones are now written with @splat, because 0.17's parser rejects the old form.
  • std.ascii.indexOfIgnoreCase (removed) -> std.ascii.findIgnoreCase at eight call sites.
  • Eval branch quota raised inside the helper only (comptime field iteration of large tables exceeded the default 1000).
  • zig fmt: CI runs zig fmt --check src/ build.zig build.zig.zon; the 0.17 formatter also rewrites a few deprecated builtins (@intFromEnum -> @backingInt) in btree/btree.zig, format/page.zig and sql/functions/aggregate.zig, so those files are reformatted to keep that check green. Formatting only.
  • Minimum version bumped to 0.17.0 in build.zig.zon, README (badge and requirements table), docs/guide/getting-started.md, CONTRIBUTING.md and .github/workflows/ci.yml (all three setup-zig versions).

This drops support for 0.16 because the helper relies on the 0.17 reflection arrays. If you would rather keep 0.16 working as well, the helper and the three call-site spellings can be made version-conditional with @hasField/@hasDecl; I am happy to rework the PR that way.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring (toolchain compatibility)

Testing

Zig 0.17.0, Linux x86_64, from a clean checkout of main (1d0cbb7) plus this branch:

  • zig fmt --check src/ build.zig build.zig.zon -> exit 0
  • zig build test --summary all --test-timeout 120s -j1 -> exit 0, Build Summary: 3/3 steps succeeded; 605/605 tests passed
  • zig build run-all-examples --summary all -j1 -> exit 0, 226/226 steps succeeded
  • New tests added: none needed, the existing suite is the check

Not run: the Windows/macOS legs of the CI matrix, zig build docs, the docs/ website build, and the ReleaseFast/cross-target check legs.

Checklist

  • Code follows project style
  • Self-review completed
  • Documentation updated (version references)

Prepared with Claude Code (AI-assisted); every command above was run by me on this branch and the outputs are the real ones.

Migrate struct reflection to the 0.17 field_names/field_types/field_attrs
accessors through one small src/compat.zig helper, spell array repetition
with @Splat where 0.17 rejects the old form, replace the removed
std.ascii.indexOfIgnoreCase and the moved Fn/StructField attribute types,
and format the tree with the 0.17 zig fmt (CI runs zig fmt --check).
Bump the minimum Zig version to 0.17.0 in build.zig.zon, README, docs,
CONTRIBUTING and the CI workflow.

This branch has not been deployed

No deployments
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.

1 participant