zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit c947e79d73d3ec7a7a7c4640f001b34f63d36d89 (tree)
parent 8af59d1f98266bd70b3afb44d196bbd151cedf22
Author: clickingbuttons <clickingbuttons@pm.me>
Date:   Mon, 22 Apr 2024 14:02:32 -0400

std.meta: give TagPayloadByName unreachable a better @compileError message

Diffstat:
Mlib/std/meta.zig | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/std/meta.zig b/lib/std/meta.zig @@ -719,7 +719,7 @@ pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type { return field_info.type; } - unreachable; + @compileError("no field '" ++ tag_name ++ "' in union '" ++ @typeName(U) ++ "'"); } /// Given a tagged union type, and an enum, return the type of the union field