From 2d9db156ae928860a9acf2f1260750d3b44a4c98 Mon Sep 17 00:00:00 2001 From: owl Date: Fri, 30 Aug 2024 12:33:10 +0200 Subject: adapt to latest zig changes --- clap.zig | 6 +++--- clap/parsers.zig | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clap.zig b/clap.zig index d03de72..8040852 100644 --- a/clap.zig +++ b/clap.zig @@ -767,7 +767,7 @@ pub fn parseEx( // fields to slices and return that. var result_args = Arguments(Id, params, value_parsers, .slice){}; inline for (meta.fields(@TypeOf(arguments))) |field| { - if (@typeInfo(field.type) == .Struct and + if (@typeInfo(field.type) == .@"struct" and @hasDecl(field.type, "toOwnedSlice")) { const slice = try @field(arguments, field.name).toOwnedSlice(allocator); @@ -884,7 +884,7 @@ fn deinitArgs( // If the multi value field is a struct, we know it is a list and should be deinited. // Otherwise, it is a slice that should be freed. switch (@typeInfo(@TypeOf(field))) { - .Struct => @field(arguments, longest.name).deinit(allocator), + .@"struct" => @field(arguments, longest.name).deinit(allocator), else => allocator.free(@field(arguments, longest.name)), } } @@ -937,7 +937,7 @@ fn Arguments( i += 1; } - return @Type(.{ .Struct = .{ + return @Type(.{ .@"struct" = .{ .layout = .auto, .fields = &fields, .decls = &.{}, diff --git a/clap/parsers.zig b/clap/parsers.zig index 874c23b..8abdf57 100644 --- a/clap/parsers.zig +++ b/clap/parsers.zig @@ -92,9 +92,9 @@ test "enumeration" { } fn ReturnType(comptime P: type) type { - return @typeInfo(P).Fn.return_type.?; + return @typeInfo(P).@"fn".return_type.?; } pub fn Result(comptime P: type) type { - return @typeInfo(ReturnType(P)).ErrorUnion.payload; + return @typeInfo(ReturnType(P)).error_union.payload; } -- cgit v1.2.3