-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
rust-lang/rust
#75687Labels
A-Alloc TraitIssues regarding the Alloc traitIssues regarding the Alloc traitProposaldisposition-pushfinished-final-comment-period
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
.
Metadata
Metadata
Assignees
Labels
A-Alloc TraitIssues regarding the Alloc traitIssues regarding the Alloc traitProposaldisposition-pushfinished-final-comment-period