diff options
| author | Meghan Denny <hello@nektro.net> | 2025-02-03 14:43:46 -0800 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-02-04 16:12:10 +0000 |
| commit | 3a4bb47fedbb890dc149622e31c75101b14c3b16 (patch) | |
| tree | a93c89e7e1dc26a6d617964287984b91f171bbd7 /lib/std | |
| parent | 08d661fcfdfb0a7b99f8bfbf4912acd21cf72d6f (diff) | |
| download | zig-3a4bb47fedbb890dc149622e31c75101b14c3b16.tar.gz zig-3a4bb47fedbb890dc149622e31c75101b14c3b16.zip | |
std.meta.FieldType: use builtin and deprecate
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/meta.zig | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig index f218c916e8..c4e3774da5 100644 --- 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 { |
