authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-02-03 14:43:46-08:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-02-04 16:12:10+00:00
log3a4bb47fedbb890dc149622e31c75101b14c3b16
treea93c89e7e1dc26a6d617964287984b91f171bbd7
parent08d661fcfdfb0a7b99f8bfbf4912acd21cf72d6f

std.meta.FieldType: use builtin and deprecate


1 files changed, 2 insertions(+), 5 deletions(-)

lib/std/meta.zig+2-5
......@@ -418,12 +418,9 @@ test fieldInfo {
418418 try testing.expect(comptime uf.type == u8);
419419}
420420
421/// Deprecated: use @FieldType
421422pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type {
422 if (@typeInfo(T) != .@"struct" and @typeInfo(T) != .@"union") {
423 @compileError("Expected struct or union, found '" ++ @typeName(T) ++ "'");
424 }
425
426 return fieldInfo(T, field).type;
423 return @FieldType(T, @tagName(field));
427424}
428425
429426test FieldType {