Rollup merge of #107878 - workingjubilee:new-size-means-bytes, r=scottmcm
Clarify `new_size` for realloc means bytes Minor docs fix requested by https://github.com/rust-lang/rust/issues/107875
This commit is contained in:
commit
dfc242220f
@ -203,7 +203,7 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
|
||||
ptr
|
||||
}
|
||||
|
||||
/// Shrink or grow a block of memory to the given `new_size`.
|
||||
/// Shrink or grow a block of memory to the given `new_size` in bytes.
|
||||
/// The block is described by the given `ptr` pointer and `layout`.
|
||||
///
|
||||
/// If this returns a non-null pointer, then ownership of the memory block
|
||||
@ -211,10 +211,11 @@ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
|
||||
/// Any access to the old `ptr` is Undefined Behavior, even if the
|
||||
/// allocation remained in-place. The newly returned pointer is the only valid pointer
|
||||
/// for accessing this memory now.
|
||||
///
|
||||
/// The new memory block is allocated with `layout`,
|
||||
/// but with the `size` updated to `new_size`. This new layout must be
|
||||
/// used when deallocating the new memory block with `dealloc`. The range
|
||||
/// `0..min(layout.size(), new_size)` of the new memory block is
|
||||
/// but with the `size` updated to `new_size` in bytes.
|
||||
/// This new layout must be used when deallocating the new memory block with `dealloc`.
|
||||
/// The range `0..min(layout.size(), new_size)` of the new memory block is
|
||||
/// guaranteed to have the same values as the original block.
|
||||
///
|
||||
/// If this method returns null, then ownership of the memory
|
||||
|
Loading…
Reference in New Issue
Block a user