authorgravatar for cartersnook04@gmail.comCarter Snook <cartersnook04@gmail.com> 2025-03-21 12:42:29-05:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2025-03-24 11:13:58+00:00
log149eace5d563a3326604baf808dabb02edbe7fba
tree7dfeeb3d7754725659004523003d4cb30b1c4941
parentadee3ee9a2c679069a15bd5476860d45f05b356b

deprecate O(n) union field type helpers in std.meta

Users should be using @FieldType() instead.

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

lib/std/meta.zig+3-2
......@@ -693,8 +693,10 @@ test activeTag {
693693 try testing.expect(activeTag(u) == UE.Float);
694694}
695695
696/// Deprecated: Use @FieldType(U, tag_name)
696697const TagPayloadType = TagPayload;
697698
699/// Deprecated: Use @FieldType(U, tag_name)
698700pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type {
699701 const info = @typeInfo(U).@"union";
700702
......@@ -706,8 +708,7 @@ pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type {
706708 @compileError("no field '" ++ tag_name ++ "' in union '" ++ @typeName(U) ++ "'");
707709}
708710
709/// Given a tagged union type, and an enum, return the type of the union field
710/// corresponding to the enum tag.
711/// Deprecated: Use @FieldType(U, @tagName(tag))
711712pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type {
712713 return TagPayloadByName(U, @tagName(tag));
713714}