From 53fb59ea9b148a9d1f694039898eb60a1df75535 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 12 Mar 2023 00:25:00 -0700 Subject: [PATCH] std.fifo: make toOwnedSlice support head != 0 --- lib/std/fifo.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/fifo.zig b/lib/std/fifo.zig index ad929cde8a..5a72b56269 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;