Skip to content

Commit 98d97b7

Browse files
committed
Use Layout::new consistently in DroplessArena::alloc.
1 parent 51edc21 commit 98d97b7

File tree

1 file changed

+3
-2
lines changed
  • compiler/rustc_arena/src

1 file changed

+3
-2
lines changed

compiler/rustc_arena/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,12 +501,13 @@ impl DroplessArena {
501501
assert!(!mem::needs_drop::<T>());
502502
assert!(mem::size_of::<T>() != 0);
503503

504-
let mem = if let Some(a) = self.alloc_raw_without_grow(Layout::for_value::<T>(&object)) {
504+
let layout = Layout::new::<T>();
505+
let mem = if let Some(a) = self.alloc_raw_without_grow(layout) {
505506
a
506507
} else {
507508
// No free space left. Allocate a new chunk to satisfy the request.
508509
// On failure the grow will panic or abort.
509-
self.grow_and_alloc_raw(Layout::new::<T>())
510+
self.grow_and_alloc_raw(layout)
510511
} as *mut T;
511512

512513
unsafe {

0 commit comments

Comments
 (0)