Closed
Description
The GlobalAlloc
trait is stable with this method:
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
(And similarly the std::alloc::realloc
function.)
Note new_size: usize
instead of new_layout: Layout
. This is because this method does not support changing the alignment.
Do we want to lift this restriction in the Alloc
trait?
The two parameters of realloc
would be old_size: usize, new_layout: Layout
. For allocators that do not support this, this would shift the responsibility to trait impls to have a fallback based on alloc
+ copy_nonoverlapping
+ dealloc
.