authorgravatar for bratishkaerik@getgoogleoff.meEric Joldasov <bratishkaerik@getgoogleoff.me> 2023-06-04 22:57:35+06:00
committergravatar for bratishkaerik@getgoogleoff.meEric Joldasov <bratishkaerik@getgoogleoff.me> 2023-06-13 23:45:08+06:00
logeb4439f1e4e617247bffff13478a9fa57160c507
tree8b177497e3f129933dfc49078346c10539c51dd1
parentdf6319418a08b611bae23307ace6688f95bedea2
signature Commit is signed but in an unrecognized format.

std.meta: remove `Vector` (deprecated in 0.10)

Followup to d42d31f72f38165f70c2850e9cc63da44b3b470c. Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>

8 files changed, 17 insertions(+), 28 deletions(-)

lib/std/hash/auto_hash.zig+4-4
......@@ -408,13 +408,13 @@ test "testHash union" {
408408}
409409
410410test "testHash vector" {
411 const a: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
412 const b: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
411 const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
412 const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
413413 try testing.expect(testHash(a) == testHash(a));
414414 try testing.expect(testHash(a) != testHash(b));
415415
416 const c: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };
417 const d: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };
416 const c: @Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };
417 const d: @Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };
418418 try testing.expect(testHash(c) == testHash(c));
419419 try testing.expect(testHash(c) != testHash(d));
420420}
lib/std/meta.zig+3-13
......@@ -146,7 +146,7 @@ test "std.meta.Child" {
146146 try testing.expect(Child(*u8) == u8);
147147 try testing.expect(Child([]u8) == u8);
148148 try testing.expect(Child(?u8) == u8);
149 try testing.expect(Child(Vector(2, u8)) == u8);
149 try testing.expect(Child(@Vector(2, u8)) == u8);
150150}
151151
152152/// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type".
......@@ -173,8 +173,8 @@ test "std.meta.Elem" {
173173 try testing.expect(Elem([*]u8) == u8);
174174 try testing.expect(Elem([]u8) == u8);
175175 try testing.expect(Elem(*[10]u8) == u8);
176 try testing.expect(Elem(Vector(2, u8)) == u8);
177 try testing.expect(Elem(*Vector(2, u8)) == u8);
176 try testing.expect(Elem(@Vector(2, u8)) == u8);
177 try testing.expect(Elem(*@Vector(2, u8)) == u8);
178178 try testing.expect(Elem(?[*]u8) == u8);
179179}
180180
......@@ -1014,16 +1014,6 @@ test "std.meta.Float" {
10141014 try testing.expectEqual(f128, Float(128));
10151015}
10161016
1017/// Deprecated. Use `@Vector`.
1018pub fn Vector(comptime len: u32, comptime child: type) type {
1019 return @Type(.{
1020 .Vector = .{
1021 .len = len,
1022 .child = child,
1023 },
1024 });
1025}
1026
10271017/// For a given function type, returns a tuple type which fields will
10281018/// correspond to the argument types.
10291019///
lib/std/meta/trait.zig+1-1
......@@ -271,7 +271,7 @@ pub fn isIndexable(comptime T: type) bool {
271271test "isIndexable" {
272272 const array = [_]u8{0} ** 10;
273273 const slice = @as([]const u8, &array);
274 const vector: meta.Vector(2, u32) = [_]u32{0} ** 2;
274 const vector: @Vector(2, u32) = [_]u32{0} ** 2;
275275 const tuple = .{ 1, 2, 3 };
276276
277277 try testing.expect(isIndexable(@TypeOf(array)));
test/cases/compile_errors/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig+2-3
......@@ -2,8 +2,7 @@ export fn f1(x: u32) u32 {
22 const y = -%x;
33 return -y;
44}
5const V = @import("std").meta.Vector;
6export fn f2(x: V(4, u32)) V(4, u32) {
5export fn f2(x: @Vector(4, u32)) @Vector(4, u32) {
76 const y = -%x;
87 return -y;
98}
......@@ -13,4 +12,4 @@ export fn f2(x: V(4, u32)) V(4, u32) {
1312// target=native
1413//
1514// :3:12: error: negation of type 'u32'
16// :8:12: error: negation of type '@Vector(4, u32)'
15// :7:12: error: negation of type '@Vector(4, u32)'
test/cases/compile_errors/comptime_vector_overflow_shows_the_index.zig+2-2
......@@ -1,6 +1,6 @@
11comptime {
2 var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };
3 var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };
2 var a: @Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };
3 var b: @Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };
44 var x = a + b;
55 _ = x;
66}
test/cases/compile_errors/nested_vectors.zig+1-1
......@@ -1,5 +1,5 @@
11export fn entry() void {
2 const V1 = @import("std").meta.Vector(4, u8);
2 const V1 = @Vector(4, u8);
33 const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } });
44 var v: V2 = undefined;
55 _ = v;
test/cases/compile_errors/shuffle_with_selected_index_past_first_vector_length.zig+2-2
......@@ -1,6 +1,6 @@
11export fn entry() void {
2 const v: @import("std").meta.Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };
3 const x: @import("std").meta.Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };
2 const v: @Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };
3 const x: @Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };
44 var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 });
55 _ = z;
66}
test/cases/compile_errors/vector_index_out_of_bounds.zig+2-2
......@@ -1,5 +1,5 @@
11export fn entry() void {
2 const x = @import("std").meta.Vector(3, f32){ 25, 75, 5, 0 };
2 const x = @Vector(3, f32){ 25, 75, 5, 0 };
33 _ = x;
44}
55
......@@ -7,4 +7,4 @@ export fn entry() void {
77// backend=stage2
88// target=native
99//
10// :2:49: error: expected 3 vector elements; found 4
10// :2:30: error: expected 3 vector elements; found 4