diff options
| author | r00ster91 <r00ster91@proton.me> | 2022-12-08 22:05:30 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-12-08 22:21:46 +0200 |
| commit | 7826e28bd38876e253f5842f53177dd9f45caa9a (patch) | |
| tree | ec1359c39bf25f8377a5f631fb0f529d8c6cc113 /lib/std/meta.zig | |
| parent | 225ed65ed2cc88fce54660250feaeb44e45943fa (diff) | |
| download | zig-7826e28bd38876e253f5842f53177dd9f45caa9a.tar.gz zig-7826e28bd38876e253f5842f53177dd9f45caa9a.zip | |
Re-apply: "std.ComptimeStringMap: use tuple types"
096d3efae5fcaa5640f4acb2f9be2d7f93f7fdb2 was not the cause of the
CI failure.
Diffstat (limited to 'lib/std/meta.zig')
| -rw-r--r-- | lib/std/meta.zig | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig index b2fd10107b..9dd1a97baf 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -115,16 +115,10 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T { // - https://github.com/ziglang/zig/issues/3863 if (@typeInfo(T).Enum.fields.len <= 100) { const kvs = comptime build_kvs: { - // In order to generate an array of structs that play nice with anonymous - // list literals, we need to give them "0" and "1" field names. - // TODO https://github.com/ziglang/zig/issues/4335 - const EnumKV = struct { - @"0": []const u8, - @"1": T, - }; + const EnumKV = struct { []const u8, T }; var kvs_array: [@typeInfo(T).Enum.fields.len]EnumKV = undefined; inline for (@typeInfo(T).Enum.fields) |enumField, i| { - kvs_array[i] = .{ .@"0" = enumField.name, .@"1" = @field(T, enumField.name) }; + kvs_array[i] = .{ enumField.name, @field(T, enumField.name) }; } break :build_kvs kvs_array[0..]; }; |
