zig

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

commit 3a4bb47fedbb890dc149622e31c75101b14c3b16 (tree)
parent 08d661fcfdfb0a7b99f8bfbf4912acd21cf72d6f
Author: Meghan Denny <hello@nektro.net>
Date:   Mon,  3 Feb 2025 14:43:46 -0800

std.meta.FieldType: use builtin and deprecate
Diffstat:
Mlib/std/meta.zig | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/std/meta.zig b/lib/std/meta.zig @@ -418,12 +418,9 @@ test fieldInfo { try testing.expect(comptime uf.type == u8); } +/// Deprecated: use @FieldType pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type { - if (@typeInfo(T) != .@"struct" and @typeInfo(T) != .@"union") { - @compileError("Expected struct or union, found '" ++ @typeName(T) ++ "'"); - } - - return fieldInfo(T, field).type; + return @FieldType(T, @tagName(field)); } test FieldType {