Commit eb4439f1e4
Changed files (8)
lib/std/hash/auto_hash.zig
@@ -408,13 +408,13 @@ test "testHash union" {
}
test "testHash vector" {
- const a: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
- const b: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
+ const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
+ const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
try testing.expect(testHash(a) == testHash(a));
try testing.expect(testHash(a) != testHash(b));
- const c: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };
- const d: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };
+ const c: @Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };
+ const d: @Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };
try testing.expect(testHash(c) == testHash(c));
try testing.expect(testHash(c) != testHash(d));
}
lib/std/meta/trait.zig
@@ -271,7 +271,7 @@ pub fn isIndexable(comptime T: type) bool {
test "isIndexable" {
const array = [_]u8{0} ** 10;
const slice = @as([]const u8, &array);
- const vector: meta.Vector(2, u32) = [_]u32{0} ** 2;
+ const vector: @Vector(2, u32) = [_]u32{0} ** 2;
const tuple = .{ 1, 2, 3 };
try testing.expect(isIndexable(@TypeOf(array)));
lib/std/meta.zig
@@ -146,7 +146,7 @@ test "std.meta.Child" {
try testing.expect(Child(*u8) == u8);
try testing.expect(Child([]u8) == u8);
try testing.expect(Child(?u8) == u8);
- try testing.expect(Child(Vector(2, u8)) == u8);
+ try testing.expect(Child(@Vector(2, u8)) == u8);
}
/// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type".
@@ -173,8 +173,8 @@ test "std.meta.Elem" {
try testing.expect(Elem([*]u8) == u8);
try testing.expect(Elem([]u8) == u8);
try testing.expect(Elem(*[10]u8) == u8);
- try testing.expect(Elem(Vector(2, u8)) == u8);
- try testing.expect(Elem(*Vector(2, u8)) == u8);
+ try testing.expect(Elem(@Vector(2, u8)) == u8);
+ try testing.expect(Elem(*@Vector(2, u8)) == u8);
try testing.expect(Elem(?[*]u8) == u8);
}
@@ -1014,16 +1014,6 @@ test "std.meta.Float" {
try testing.expectEqual(f128, Float(128));
}
-/// Deprecated. Use `@Vector`.
-pub fn Vector(comptime len: u32, comptime child: type) type {
- return @Type(.{
- .Vector = .{
- .len = len,
- .child = child,
- },
- });
-}
-
/// For a given function type, returns a tuple type which fields will
/// correspond to the argument types.
///
test/cases/compile_errors/comptime_vector_overflow_shows_the_index.zig
@@ -1,6 +1,6 @@
comptime {
- var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };
- var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };
+ var a: @Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };
+ var b: @Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };
var x = a + b;
_ = x;
}
test/cases/compile_errors/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig
@@ -2,8 +2,7 @@ export fn f1(x: u32) u32 {
const y = -%x;
return -y;
}
-const V = @import("std").meta.Vector;
-export fn f2(x: V(4, u32)) V(4, u32) {
+export fn f2(x: @Vector(4, u32)) @Vector(4, u32) {
const y = -%x;
return -y;
}
@@ -13,4 +12,4 @@ export fn f2(x: V(4, u32)) V(4, u32) {
// target=native
//
// :3:12: error: negation of type 'u32'
-// :8:12: error: negation of type '@Vector(4, u32)'
+// :7:12: error: negation of type '@Vector(4, u32)'
test/cases/compile_errors/nested_vectors.zig
@@ -1,5 +1,5 @@
export fn entry() void {
- const V1 = @import("std").meta.Vector(4, u8);
+ const V1 = @Vector(4, u8);
const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } });
var v: V2 = undefined;
_ = v;
test/cases/compile_errors/shuffle_with_selected_index_past_first_vector_length.zig
@@ -1,6 +1,6 @@
export fn entry() void {
- const v: @import("std").meta.Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };
- const x: @import("std").meta.Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };
+ const v: @Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };
+ const x: @Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };
var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 });
_ = z;
}
test/cases/compile_errors/vector_index_out_of_bounds.zig
@@ -1,5 +1,5 @@
export fn entry() void {
- const x = @import("std").meta.Vector(3, f32){ 25, 75, 5, 0 };
+ const x = @Vector(3, f32){ 25, 75, 5, 0 };
_ = x;
}
@@ -7,4 +7,4 @@ export fn entry() void {
// backend=stage2
// target=native
//
-// :2:49: error: expected 3 vector elements; found 4
+// :2:30: error: expected 3 vector elements; found 4