aboutsummaryrefslogtreecommitdiff
path: root/lib/std/meta.zig
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-09-28 12:24:22 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-09-28 12:24:22 +0200
commitc2d60bc5b5dd9ac39760588c777cc6809732af19 (patch)
tree8b52eedf6c36703cd89613ade67f4715c5ff284a /lib/std/meta.zig
parent933146699806fc25f8182f53cd8c217654d51664 (diff)
downloadzig-c2d60bc5b5dd9ac39760588c777cc6809732af19.tar.gz
zig-c2d60bc5b5dd9ac39760588c777cc6809732af19.zip
Follows @tadeokondrak remark about taking `[]const type`.
Diffstat (limited to 'lib/std/meta.zig')
-rw-r--r--lib/std/meta.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index 5b4920157a..13d3c574e9 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -831,10 +831,10 @@ test "sizeof" {
/// with those types as fields.
///
/// Examples:
-/// - `Tuple(.{})` ⇒ `tuple { }`
-/// - `Tuple(.{f32})` ⇒ `tuple { f32 }`
-/// - `Tuple(.{f32,u32})` ⇒ `tuple { f32, u32 }`
-pub fn Tuple(comptime types: anytype) type {
+/// - `Tuple(&[_]type {})` ⇒ `tuple { }`
+/// - `Tuple(&[_]type {f32})` ⇒ `tuple { f32 }`
+/// - `Tuple(&[_]type {f32,u32})` ⇒ `tuple { f32, u32 }`
+pub fn Tuple(comptime types: []const type) type {
var tuple_fields: [types.len]std.builtin.TypeInfo.StructField = undefined;
inline for (types) |T, i| {
@setEvalBranchQuota(10_000);
@@ -883,8 +883,8 @@ test "Tuple" {
}
};
- T.assertTuple(.{}, Tuple(.{}));
- T.assertTuple(.{u32}, Tuple(.{u32}));
- T.assertTuple(.{ u32, f16 }, Tuple(.{ u32, f16 }));
- T.assertTuple(.{ u32, f16, []const u8 }, Tuple(.{ u32, f16, []const u8 }));
+ T.assertTuple(.{}, Tuple(&[_]type{}));
+ T.assertTuple(.{u32}, Tuple(&[_]type{u32}));
+ T.assertTuple(.{ u32, f16 }, Tuple(&[_]type{ u32, f16 }));
+ T.assertTuple(.{ u32, f16, []const u8 }, Tuple(&[_]type{ u32, f16, []const u8 }));
}