diff options
| author | Tim Diekmann <21277928+TimDiekmann@users.noreply.github.com> | 2020-08-01 21:51:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-01 21:51:50 +0200 |
| commit | 9cd9286e20e6fe4cdb7e298fa5ec966eb26fa32b (patch) | |
| tree | 37d8d63a1292aa3218da6d58617684254bcca650 /library/core/src/alloc | |
| parent | b01fbc437eae177cd02e7798f2f1454c1c6ed6e5 (diff) | |
| download | rust-9cd9286e20e6fe4cdb7e298fa5ec966eb26fa32b.tar.gz rust-9cd9286e20e6fe4cdb7e298fa5ec966eb26fa32b.zip | |
Update doc-comment for grow_zeroed
Diffstat (limited to 'library/core/src/alloc')
| -rw-r--r-- | library/core/src/alloc/mod.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/library/core/src/alloc/mod.rs b/library/core/src/alloc/mod.rs index f5632b578ae..fc62bb453a2 100644 --- a/library/core/src/alloc/mod.rs +++ b/library/core/src/alloc/mod.rs @@ -226,9 +226,14 @@ pub unsafe trait AllocRef { /// Behaves like `grow`, but also ensures that the new contents are set to zero before being /// returned. /// - /// The memory block will contain the following contents after a successful call to `grow`: + /// The memory block will contain the following contents after a successful call to + /// `grow_zeroed`: /// * Bytes `0..layout.size()` are preserved from the original allocation. - /// * Bytes `layout.size()..new_size` are zeroed. `new_size` refers to + /// * Bytes `layout.size()..old_size` will either be preserved or zeroed, + /// depending on the allocator implementation. `old_size` refers to the size of + /// the `MemoryBlock` prior to the `grow_zeroed` call, which may be larger than the size + /// that was originally requested when it was allocated. + /// * Bytes `old_size..new_size` are zeroed. `new_size` refers to /// the size of the `MemoryBlock` returned by the `grow` call. /// /// # Safety |
