std.meta: remove Vector (deprecated in 0.10)

Followup to d42d31f72f38165f70c2850e9cc63da44b3b470c.
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
This commit is contained in:
Eric Joldasov 2023-06-04 22:57:35 +06:00
parent df6319418a
commit eb4439f1e4
No known key found for this signature in database
GPG Key ID: 5C9C69060686B588
8 changed files with 17 additions and 28 deletions

View File

@ -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));
}

View File

@ -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.
///

View File

@ -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)));

View File

@ -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)'

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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