From c25b157ddaede518d92ee2d87ad536a5b6b097de Mon Sep 17 00:00:00 2001 From: Josh Holland Date: Fri, 6 Nov 2020 18:54:08 +0000 Subject: remove deprecated uses of ArrayList.span --- lib/std/array_list.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/std/array_list.zig') diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 9144d2c644..51d4d65df7 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -1061,7 +1061,7 @@ test "std.ArrayList(u8) implements outStream" { const y: i32 = 1234; try buffer.outStream().print("x: {}\ny: {}\n", .{ x, y }); - testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.span()); + testing.expectEqualSlices(u8, "x: 42\ny: 1234\n", buffer.items); } test "std.ArrayList/ArrayListUnmanaged.shrink still sets length on error.OutOfMemory" { -- cgit v1.2.3 From a1ec5448c77bee8d91c7e33d16416406b22fa159 Mon Sep 17 00:00:00 2001 From: Josh Holland Date: Fri, 6 Nov 2020 18:57:26 +0000 Subject: make ArrayList.span into a compile error --- lib/std/array_list.zig | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'lib/std/array_list.zig') diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 51d4d65df7..ab47510cb7 100644 --- a/lib/std/array_list.zig +++ b/lib/std/array_list.zig @@ -59,13 +59,7 @@ pub fn ArrayListAligned(comptime T: type, comptime alignment: ?u29) type { self.allocator.free(self.allocatedSlice()); } - /// Deprecated: use `items` field directly. - /// Return contents as a slice. Only valid while the list - /// doesn't change size. - pub fn span(self: anytype) @TypeOf(self.items) { - return self.items; - } - + pub const span = @compileError("deprecated: use `items` field directly"); pub const toSlice = @compileError("deprecated: use `items` field directly"); pub const toSliceConst = @compileError("deprecated: use `items` field directly"); pub const at = @compileError("deprecated: use `list.items[i]`"); -- cgit v1.2.3