aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorTadeo Kondrak <me@tadeo.ca>2020-04-30 04:30:01 -0600
committerTadeo Kondrak <me@tadeo.ca>2020-05-02 14:39:31 -0600
commit647901b4a82dbb89656c620d4d4a89869fdf1fa0 (patch)
tree19b297cc713d1ea63d64d4d42130f78d375d269f /lib/std/meta.zig
parentca6db2d008cf3e0e3700e84400bd3d6e259e3c0f (diff)
downloadzig-647901b4a82dbb89656c620d4d4a89869fdf1fa0.tar.gz
zig-647901b4a82dbb89656c620d4d4a89869fdf1fa0.zip
Constify TypeInfo
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index e38712af2b..4fc74282a5 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -219,7 +219,7 @@ test "std.meta.containerLayout" {
testing.expect(containerLayout(U3) == .Extern);
}
-pub fn declarations(comptime T: type) []TypeInfo.Declaration {
+pub fn declarations(comptime T: type) []const TypeInfo.Declaration {
return switch (@typeInfo(T)) {
.Struct => |info| info.decls,
.Enum => |info| info.decls,
@@ -243,7 +243,7 @@ test "std.meta.declarations" {
fn a() void {}
};
- const decls = comptime [_][]TypeInfo.Declaration{
+ const decls = comptime [_][]const TypeInfo.Declaration{
declarations(E1),
declarations(S1),
declarations(U1),
@@ -292,10 +292,10 @@ test "std.meta.declarationInfo" {
}
pub fn fields(comptime T: type) switch (@typeInfo(T)) {
- .Struct => []TypeInfo.StructField,
- .Union => []TypeInfo.UnionField,
- .ErrorSet => []TypeInfo.Error,
- .Enum => []TypeInfo.EnumField,
+ .Struct => []const TypeInfo.StructField,
+ .Union => []const TypeInfo.UnionField,
+ .ErrorSet => []const TypeInfo.Error,
+ .Enum => []const TypeInfo.EnumField,
else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
} {
return switch (@typeInfo(T)) {