diff options
| author | Veikka Tuominen <git@vexu.eu> | 2020-11-18 13:14:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-18 13:14:48 +0200 |
| commit | 6d5b76a75d204ac2ce9fb2e03744d9733169dbe3 (patch) | |
| tree | 7fbdbc258851b0ee8e8635373d6b81b12168af68 /lib/std/array_list.zig | |
| parent | 66d6930b5c023deb65ea23eb0c4c5029b50b40a3 (diff) | |
| parent | a1ec5448c77bee8d91c7e33d16416406b22fa159 (diff) | |
| download | zig-6d5b76a75d204ac2ce9fb2e03744d9733169dbe3.tar.gz zig-6d5b76a75d204ac2ce9fb2e03744d9733169dbe3.zip | |
Merge pull request #7005 from jshholland/deprecate-span
Remove ArrayList.span
Diffstat (limited to 'lib/std/array_list.zig')
| -rw-r--r-- | lib/std/array_list.zig | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig index 9144d2c644..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]`"); @@ -1061,7 +1055,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" { |
