diff --git a/lib/std/fifo.zig b/lib/std/fifo.zig index ad929cde8af1a300fe08b914733a399b82d6468a..5a72b5626938679e69c7fd45a7db09baa217ad37 100644 --- a/lib/std/fifo.zig +++ b/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;