This commit is contained in:
Keith Turner 2025-11-23 22:57:06 +00:00 committed by GitHub
commit 5840f5ca4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -608,6 +608,8 @@ pub fn testAllocator(base_allocator: mem.Allocator) !void {
// Zero-length allocation
const empty = try allocator.alloc(u8, 0);
try testing.expect(empty.len == 0);
try testing.expect(empty.ptr == @as([*]u8, @ptrFromInt(std.math.maxInt(usize))));
allocator.free(empty);
// Allocation with zero-sized types
const zero_bit_ptr = try allocator.create(u0);