Skip to content

Commit 9cd9286

Browse files
authored
Update doc-comment for grow_zeroed
1 parent b01fbc4 commit 9cd9286

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

library/core/src/alloc/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,14 @@ pub unsafe trait AllocRef {
226226
/// Behaves like `grow`, but also ensures that the new contents are set to zero before being
227227
/// returned.
228228
///
229-
/// The memory block will contain the following contents after a successful call to `grow`:
229+
/// The memory block will contain the following contents after a successful call to
230+
/// `grow_zeroed`:
230231
/// * Bytes `0..layout.size()` are preserved from the original allocation.
231-
/// * Bytes `layout.size()..new_size` are zeroed. `new_size` refers to
232+
/// * Bytes `layout.size()..old_size` will either be preserved or zeroed,
233+
/// depending on the allocator implementation. `old_size` refers to the size of
234+
/// the `MemoryBlock` prior to the `grow_zeroed` call, which may be larger than the size
235+
/// that was originally requested when it was allocated.
236+
/// * Bytes `old_size..new_size` are zeroed. `new_size` refers to
232237
/// the size of the `MemoryBlock` returned by the `grow` call.
233238
///
234239
/// # Safety

0 commit comments

Comments
 (0)