std.meta: give TagPayloadByName unreachable a better @compileError message

This commit is contained in:
clickingbuttons 2024-04-22 14:02:32 -04:00 committed by Veikka Tuominen
parent 8af59d1f98
commit c947e79d73

View File

@ -719,7 +719,7 @@ pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type {
return field_info.type;
}
unreachable;
@compileError("no field '" ++ tag_name ++ "' in union '" ++ @typeName(U) ++ "'");
}
/// Given a tagged union type, and an enum, return the type of the union field