Skip to content

Commit 25407bc

Browse files
committed
Make DroplessArena::alloc call DroplessArena::alloc_raw.
They're very similar.
1 parent 98d97b7 commit 25407bc

File tree

1 file changed

+1
-8
lines changed
  • compiler/rustc_arena/src

1 file changed

+1
-8
lines changed

compiler/rustc_arena/src/lib.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,7 @@ impl DroplessArena {
501501
assert!(!mem::needs_drop::<T>());
502502
assert!(mem::size_of::<T>() != 0);
503503

504-
let layout = Layout::new::<T>();
505-
let mem = if let Some(a) = self.alloc_raw_without_grow(layout) {
506-
a
507-
} else {
508-
// No free space left. Allocate a new chunk to satisfy the request.
509-
// On failure the grow will panic or abort.
510-
self.grow_and_alloc_raw(layout)
511-
} as *mut T;
504+
let mem = self.alloc_raw(Layout::new::<T>()) as *mut T;
512505

513506
unsafe {
514507
// Write into uninitialized memory.

0 commit comments

Comments
 (0)