aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorMeghan Denny <hello@nektro.net>2025-02-03 14:43:46 -0800
committerMatthew Lugg <mlugg@mlugg.co.uk>2025-02-04 16:12:10 +0000
commit3a4bb47fedbb890dc149622e31c75101b14c3b16 (patch)
treea93c89e7e1dc26a6d617964287984b91f171bbd7 /lib/std/meta.zig
parent08d661fcfdfb0a7b99f8bfbf4912acd21cf72d6f (diff)
downloadzig-3a4bb47fedbb890dc149622e31c75101b14c3b16.tar.gz
zig-3a4bb47fedbb890dc149622e31c75101b14c3b16.zip
std.meta.FieldType: use builtin and deprecate
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig7
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 {