| ... | ... | @@ -445,7 +445,10 @@ pub fn reallocAdvanced( |
| 445 | 445 | /// To free a single item, see `destroy`. |
| 446 | 446 | pub fn free(self: Allocator, memory: anytype) void { |
| 447 | 447 | const slice_info = @typeInfo(@TypeOf(memory)).pointer; |
| 448 | | comptime assert(slice_info.size == .slice); |
| 448 | if (slice_info.size != .slice) { |
| 449 | // slicing with comptime-known start and end results in *[len]T, which may be free'd |
| 450 | comptime assert(slice_info.size == .one and @typeInfo(slice_info.child) == .array); |
| 451 | } |
| 449 | 452 | const bytes: []u8 = @ptrCast(@constCast(mem.absorbSentinel(memory))); |
| 450 | 453 | if (bytes.len == 0) return; |
| 451 | 454 | @memset(bytes, undefined); |