Make DroplessArena::alloc
call DroplessArena::alloc_raw
.
They're very similar.
This commit is contained in:
parent
98d97b7323
commit
25407bc0bb
@ -501,14 +501,7 @@ impl DroplessArena {
|
|||||||
assert!(!mem::needs_drop::<T>());
|
assert!(!mem::needs_drop::<T>());
|
||||||
assert!(mem::size_of::<T>() != 0);
|
assert!(mem::size_of::<T>() != 0);
|
||||||
|
|
||||||
let layout = Layout::new::<T>();
|
let mem = self.alloc_raw(Layout::new::<T>()) as *mut T;
|
||||||
let mem = if let Some(a) = self.alloc_raw_without_grow(layout) {
|
|
||||||
a
|
|
||||||
} else {
|
|
||||||
// No free space left. Allocate a new chunk to satisfy the request.
|
|
||||||
// On failure the grow will panic or abort.
|
|
||||||
self.grow_and_alloc_raw(layout)
|
|
||||||
} as *mut T;
|
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
// Write into uninitialized memory.
|
// Write into uninitialized memory.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user