diff options
| author | Eric Joldasov <bratishkaerik@getgoogleoff.me> | 2023-11-17 23:36:44 +0600 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-11-18 16:25:55 +0200 |
| commit | 4e212f16506b88d934d9a0c559fa6b2e0e88574e (patch) | |
| tree | 5593aa70f985b759e7633e08d3e4bcd2642513f8 /lib/std/buf_map.zig | |
| parent | 7b99189f191df47c400693f324128d26804ee84d (diff) | |
| download | zig-4e212f16506b88d934d9a0c559fa6b2e0e88574e.tar.gz zig-4e212f16506b88d934d9a0c559fa6b2e0e88574e.zip | |
std.enums: allow non-exhaustive enums in EnumIndexer and make `count` comptime_int instead of usize
Seems like this restriction was actual when Ziglang had extern enums,
but now it's not neccessary and can be lifted. It was present since
original PR which introduced std.enums, https://www.github.com/ziglang/zig/pull/8171.
See also: https://ziggit.dev/t/catching-invalid-enum-value-errors/2206/11
* Make `count` comptime_int instead of usize
With previous type, creating EnumIndexer for enum(usize) and enum(isize)
would cause compile error since `count` could not store maxInt(usize) + 1.
Now it can store it and reflects len field from std.builtin.Type.Array
(most common use case of count field inside std.enums functions is creating arrays).
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
Diffstat (limited to 'lib/std/buf_map.zig')
0 files changed, 0 insertions, 0 deletions
