From 317ed57cb1e238664a123b940f4a50697653a9bb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 13 Jul 2018 21:43:11 -0400 Subject: [PATCH] docs: clarify mem.Allocator.reallocFn --- std/mem.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/std/mem.zig b/std/mem.zig index 41c5d0c8a3..32c17fcb26 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -23,7 +23,10 @@ pub const Allocator = struct { /// * this function must return successfully. /// * alignment <= alignment of old_mem.ptr /// - /// The returned newly allocated memory is undefined. + /// When `reallocFn` returns, + /// `return_value[0..min(old_mem.len, new_byte_count)]` must be the same + /// as `old_mem` was when `reallocFn` is called. The bytes of + /// `return_value[old_mem.len..]` have undefined values. /// `alignment` is guaranteed to be >= 1 /// `alignment` is guaranteed to be a power of 2 reallocFn: fn (self: *Allocator, old_mem: []u8, new_byte_count: usize, alignment: u29) Error![]u8,