Commit 53fb59ea9b

Andrew Kelley <andrew@ziglang.org>
2023-03-12 08:25:00
std.fifo: make toOwnedSlice support head != 0
1 parent fbce6a7
Changed files (1)
lib
lib/std/fifo.zig
@@ -385,6 +385,7 @@ pub fn LinearFifo(
         }
 
         pub fn toOwnedSlice(self: *Self) Allocator.Error![]T {
+            if (self.head != 0) self.realign();
             assert(self.head == 0);
             assert(self.count <= self.buf.len);
             const allocator = self.allocator;