diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig index 80341ecc2fa30523ef26bf7f1f68087fea18b925..486c69966e0e3d9bccf1b99e92d404cc36363283 100644 --- a/lib/std/mem/Allocator.zig +++ b/lib/std/mem/Allocator.zig @@ -587,4 +587,7 @@ fn unreachableFree( test failing { const f: Allocator = .failing; try std.testing.expectError(error.OutOfMemory, f.alloc(u8, 123)); + // Expect very large allocations to fail at the implementation level and not in the interface + try std.testing.expectError(error.OutOfMemory, f.alloc(u8, std.math.maxInt(usize))); + try std.testing.expectError(error.OutOfMemory, f.allocSentinel(u8, std.math.maxInt(usize) - 1, 0)); }