Commit 5bfd9238de

Zander Khan <git@zander.xyz>
2021-01-17 15:43:38
Remove `resize`. Adding uninitialized memory at the end of the `items` would break the heap property.
1 parent 9a09ebb
lib/std/priority_dequeue.zig
@@ -377,11 +377,6 @@ pub fn PriorityDequeue(comptime T: type) type {
             self.items = try self.allocator.realloc(self.items, better_capacity);
         }
 
-        pub fn resize(self: *Self, new_len: usize) !void {
-            try self.ensureCapacity(new_len);
-            self.len = new_len;
-        }
-
         /// Reduce allocated capacity to `new_len`.
         pub fn shrinkAndFree(self: *Self, new_len: usize) void {
             assert(new_len <= self.items.len);
lib/std/priority_queue.zig
@@ -187,11 +187,6 @@ pub fn PriorityQueue(comptime T: type) type {
             self.items = try self.allocator.realloc(self.items, better_capacity);
         }
 
-        pub fn resize(self: *Self, new_len: usize) !void {
-            try self.ensureCapacity(new_len);
-            self.len = new_len;
-        }
-
         /// Reduce allocated capacity to `new_len`.
         pub fn shrinkAndFree(self: *Self, new_len: usize) void {
             assert(new_len <= self.items.len);