about summary refs log tree commit diff
path: root/src/liballoc/heap.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-04-04 17:19:16 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-04-12 22:53:13 +0200
commitc957e99b305ecee113442a7ce0edd6b565200ca9 (patch)
tree02c7f8f7f8f35577d74dfb057625a2a4dae717a7 /src/liballoc/heap.rs
parentb017742136a5d02b6ba0f2080e97d18a8bfeba4b (diff)
realloc with a new size only, not a full new layout.
Changing the alignment with realloc is not supported.
Diffstat (limited to 'src/liballoc/heap.rs')
-rw-r--r--src/liballoc/heap.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
index 765fb8458d1..e79383331e1 100644
--- a/src/liballoc/heap.rs
+++ b/src/liballoc/heap.rs
@@ -64,7 +64,7 @@ unsafe impl<T> Alloc for T where T: CoreAlloc {
                       ptr: *mut u8,
                       layout: Layout,
                       new_layout: Layout) -> Result<*mut u8, AllocErr> {
-        CoreAlloc::realloc(self, ptr, layout, new_layout)
+        CoreAlloc::realloc(self, ptr, layout, new_layout.size())
     }
 
     unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
@@ -79,20 +79,20 @@ unsafe impl<T> Alloc for T where T: CoreAlloc {
                              ptr: *mut u8,
                              layout: Layout,
                              new_layout: Layout) -> Result<Excess, AllocErr> {
-        CoreAlloc::realloc_excess(self, ptr, layout, new_layout)
+        CoreAlloc::realloc_excess(self, ptr, layout, new_layout.size())
     }
 
     unsafe fn grow_in_place(&mut self,
                             ptr: *mut u8,
                             layout: Layout,
                             new_layout: Layout) -> Result<(), CannotReallocInPlace> {
-        CoreAlloc::grow_in_place(self, ptr, layout, new_layout)
+        CoreAlloc::grow_in_place(self, ptr, layout, new_layout.size())
     }
 
     unsafe fn shrink_in_place(&mut self,
                               ptr: *mut u8,
                               layout: Layout,
                               new_layout: Layout) -> Result<(), CannotReallocInPlace> {
-        CoreAlloc::shrink_in_place(self, ptr, layout, new_layout)
+        CoreAlloc::shrink_in_place(self, ptr, layout, new_layout.size())
     }
 }