std.testing: delete refAllDeclsRecursive

suggested alternatives:
- actual tests
- explicitly list the decls
- compile an example application that uses the API
- stop worrying about dead code
- refAllDecls (non recursive) in each file

Don't fight the laziness, embrace it.

closes #23608
closes #30813
This commit is contained in:
Andrew Kelley
2026-01-16 12:30:24 -08:00
parent 081888286b
commit 790d28d6cd
3 changed files with 2 additions and 18 deletions
+1 -2
View File
@@ -53,6 +53,5 @@ pub const HiiDatabase = @import("protocol/hii_database.zig").HiiDatabase;
pub const HiiPopup = @import("protocol/hii_popup.zig").HiiPopup;
test {
@setEvalBranchQuota(2000);
@import("std").testing.refAllDeclsRecursive(@This());
std.testing.refAllDecls(@This());
}
+1 -1
View File
@@ -305,5 +305,5 @@ pub const global_variable = Guid{
};
test {
std.testing.refAllDeclsRecursive(@This());
std.testing.refAllDecls(@This());
}
-15
View File
@@ -1200,21 +1200,6 @@ pub fn refAllDecls(comptime T: type) void {
}
}
/// Given a type, recursively references all the declarations inside, so that the semantic analyzer sees them.
/// For deep types, you may use `@setEvalBranchQuota`.
pub fn refAllDeclsRecursive(comptime T: type) void {
if (!builtin.is_test) return;
inline for (comptime std.meta.declarations(T)) |decl| {
if (@TypeOf(@field(T, decl.name)) == type) {
switch (@typeInfo(@field(T, decl.name))) {
.@"struct", .@"enum", .@"union", .@"opaque" => refAllDeclsRecursive(@field(T, decl.name)),
else => {},
}
}
_ = &@field(T, decl.name);
}
}
pub const FuzzInputOptions = struct {
corpus: []const []const u8 = &.{},
};