From fa5758304d113679d9bd82187b2bad5fde95554e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mondaini=20Calva=CC=83o?= Date: Thu, 14 May 2026 08:51:38 -0300 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20migrate=20to=20Zig=200.16=20(partia?= =?UTF-8?q?l=20=E2=80=94=20tests=20blocked=20by=20zspec=20dep)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Library source migrated to the new 0.16 APIs: - @Type(.{ .@"struct" }) → @Struct(...) - std.testing.refAllDeclsRecursive → refAllDecls `zig build` passes. `zig build test` cannot run yet because the pinned zspec dep is itself 0.16-incompatible (calls removed APIs in factory.zig and runner.zig). Will be unblocked once zspec is migrated/republished. Co-Authored-By: Claude Opus 4.7 (1M context) --- build.zig.zon | 2 +- src/zon_coercion.zig | 43 +++++++++++++------------------------------ tests/root.zig | 2 +- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index a45fd47..746dfbd 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,7 +2,7 @@ .name = .zig_utils, .version = "0.6.1", .fingerprint = 0x6dc482caf73c4a75, - .minimum_zig_version = "0.15.2", + .minimum_zig_version = "0.16.0", .dependencies = .{ .zspec = .{ diff --git a/src/zon_coercion.zig b/src/zon_coercion.zig index a40857d..eb3bd98 100644 --- a/src/zon_coercion.zig +++ b/src/zon_coercion.zig @@ -258,55 +258,38 @@ fn MergedStructType(comptime BaseType: type, comptime OverridesType: type) type } } - comptime var fields: [field_count]std.builtin.Type.StructField = undefined; + comptime var field_names: [field_count][]const u8 = undefined; + comptime var field_types: [field_count]type = undefined; + comptime var field_attrs: [field_count]std.builtin.Type.StructField.Attributes = undefined; comptime var i = 0; inline for (base_fields) |bf| { if (@hasField(OverridesType, bf.name)) { inline for (override_fields) |of| { if (comptime std.mem.eql(u8, of.name, bf.name)) { - fields[i] = .{ - .name = bf.name, - .type = of.type, - .default_value_ptr = null, - .is_comptime = false, - .alignment = @alignOf(of.type), - }; + field_names[i] = bf.name; + field_types[i] = of.type; + field_attrs[i] = .{ .@"align" = @alignOf(of.type) }; } } } else { - fields[i] = .{ - .name = bf.name, - .type = bf.type, - .default_value_ptr = null, - .is_comptime = false, - .alignment = @alignOf(bf.type), - }; + field_names[i] = bf.name; + field_types[i] = bf.type; + field_attrs[i] = .{ .@"align" = @alignOf(bf.type) }; } i += 1; } inline for (override_fields) |of| { if (!@hasField(BaseType, of.name)) { - fields[i] = .{ - .name = of.name, - .type = of.type, - .default_value_ptr = null, - .is_comptime = false, - .alignment = @alignOf(of.type), - }; + field_names[i] = of.name; + field_types[i] = of.type; + field_attrs[i] = .{ .@"align" = @alignOf(of.type) }; i += 1; } } - return @Type(.{ - .@"struct" = .{ - .layout = .auto, - .fields = &fields, - .decls = &.{}, - .is_tuple = false, - }, - }); + return @Struct(.auto, null, &field_names, &field_types, &field_attrs); } /// Check if a struct type has any fields diff --git a/tests/root.zig b/tests/root.zig index 383ca63..08aa72a 100644 --- a/tests/root.zig +++ b/tests/root.zig @@ -12,5 +12,5 @@ pub const heuristics_test = @import("heuristics_test.zig"); pub const zon_coercion_test = @import("zon_coercion_test.zig"); test { - std.testing.refAllDeclsRecursive(@This()); + std.testing.refAllDecls(@This()); } From 2de40f9f69321944c04e5f11e12b4caab97d377a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mondaini=20Calva=CC=83o?= Date: Thu, 14 May 2026 09:13:46 -0300 Subject: [PATCH 2/5] chore: bump zspec to 0.16-compatible fork Unblocks tests that previously failed due to zspec using removed 0.16 stdlib APIs. Co-Authored-By: Claude Opus 4.7 (1M context) --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 746dfbd..809570d 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -6,8 +6,8 @@ .dependencies = .{ .zspec = .{ - .url = "https://github.com/apotema/zspec/archive/v0.7.0.tar.gz", - .hash = "zspec-0.7.0-jaKLbVqmAwDxLB7GYHuw354BQp7_uBSN9rSBUIfAx5xy", + .url = "git+https://github.com/apotema/zspec.git?ref=feat/zig-0.16-migration#42e1e69e31a6971c93e6807d29eabe30d9f46bd6", + .hash = "zspec-0.8.0-jaKLbe3SAwDRIFxFJbSQvz_lr9Xn-trRT9KR16I8C5_P", }, }, From 6ad88cb7dac57fdc6bdc3b4f387cf8af5e07fbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mondaini=20Calva=CC=83o?= Date: Thu, 14 May 2026 09:51:38 -0300 Subject: [PATCH 3/5] ci: bump Zig toolchain to 0.16.0 in workflows Zig 0.16 migration requires CI to run on 0.16.0 too. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c8b2e7..9ae0bcf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Zig uses: mlugg/setup-zig@v2 with: - version: 0.15.2 + version: 0.16.0 - name: Run tests run: zig build test From 4ef722dce473ee09f24150704007ea2473fe0696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mondaini=20Calva=CC=83o?= Date: Thu, 14 May 2026 10:46:28 -0300 Subject: [PATCH 4/5] chore: bump zspec to v0.9.0 release Zspec's 0.16 migration is now published as a tagged release. Co-Authored-By: Claude Opus 4.7 (1M context) --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 809570d..db1bdb9 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -6,8 +6,8 @@ .dependencies = .{ .zspec = .{ - .url = "git+https://github.com/apotema/zspec.git?ref=feat/zig-0.16-migration#42e1e69e31a6971c93e6807d29eabe30d9f46bd6", - .hash = "zspec-0.8.0-jaKLbe3SAwDRIFxFJbSQvz_lr9Xn-trRT9KR16I8C5_P", + .url = "https://github.com/apotema/zspec/archive/v0.9.0.tar.gz", + .hash = "zspec-0.9.0-jaKLba73AwB5EK3YFyhpQ4roFBA_hhGbVvjSjur3KxZz", }, }, From e441eb8ea16c3db9d1f03911bc91a5b74f590939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mondaini=20Calva=CC=83o?= Date: Thu, 14 May 2026 10:53:40 -0300 Subject: [PATCH 5/5] chore: bump zspec to v0.9.1 --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index db1bdb9..b2694fb 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -6,8 +6,8 @@ .dependencies = .{ .zspec = .{ - .url = "https://github.com/apotema/zspec/archive/v0.9.0.tar.gz", - .hash = "zspec-0.9.0-jaKLba73AwB5EK3YFyhpQ4roFBA_hhGbVvjSjur3KxZz", + .url = "https://github.com/apotema/zspec/archive/v0.9.1.tar.gz", + .hash = "zspec-0.9.1-jaKLbbX4AwBKANdetxzzWc3UTO0UY0lcJJzTagQHlt5K", }, },