@@ -221,21 +221,22 @@ pub unsafe trait AllocRef {
221221 /// allocation referenced by `ptr` to fit the new layout. If the [`placement`] is
222222 /// [`InPlace`], the returned pointer is guaranteed to be the same as the passed `ptr`.
223223 ///
224- /// If this returns `Ok`, then ownership of the memory block referenced by `ptr` has been
225- /// transferred to this allocator. The memory may or may not have been freed, and should be
226- /// considered unusable (unless of course it was transferred back to the caller again via the
224+ /// If `ReallocPlacement::MayMove` is used then ownership of the memory block referenced by `ptr`
225+ /// is transferred to this allocator. The memory may or may not be freed, and should be
226+ /// considered unusable (unless of course it is transferred back to the caller again via the
227227 /// return value of this method).
228228 ///
229229 /// If this method returns `Err`, then ownership of the memory block has not been transferred to
230230 /// this allocator, and the contents of the memory block are unaltered.
231231 ///
232- /// The behavior of how the allocator tries to grow the memory is specified by [`placement`].
233- /// After growing a memory block, the new memory can be separated into three regions:
234- /// 1. `0..layout.size()`. This region is preserved or copied as appropriate from `ptr`.
235- /// 2. `layout.size()..allocated_size` where `allocated_size` is the latest returned
236- /// size of the allocator. The new content is implementation defined. Allocators may
237- /// initialize it according to [`init`] or leave them as is.
238- /// 3. `allocated_size..returned_size` is initialized according to [`init`].
232+ /// The memory block will contain the following contents after a successful call to `grow`:
233+ /// * Bytes `0..layout.size()` are preserved from the original allocation.
234+ /// * Bytes `layout.size()..old_size` will either be preserved or initialized according to
235+ /// [`init`], depending on the allocator implementation. `old_size` refers to the size of
236+ /// the `MemoryBlock` prior to the `grow` call, which may be larger than the size
237+ /// that was originally requested when it was allocated.
238+ /// * Bytes `old_size..new_size` are initialized according to [`init`]. `new_size` refers to
239+ /// the size of the `MemoryBlock` returned by the `grow` call.
239240 ///
240241 /// [`InPlace`]: ReallocPlacement::InPlace
241242 /// [`placement`]: ReallocPlacement
0 commit comments