From 98d97b7323a55fce821bab6606bf216dbb97523a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 20 Sep 2023 07:45:46 +1000 Subject: [PATCH] Use `Layout::new` consistently in `DroplessArena::alloc`. --- compiler/rustc_arena/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 5c183afc087..d793158d85f 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -501,12 +501,13 @@ pub fn alloc(&self, object: T) -> &mut T { assert!(!mem::needs_drop::()); assert!(mem::size_of::() != 0); - let mem = if let Some(a) = self.alloc_raw_without_grow(Layout::for_value::(&object)) { + let layout = Layout::new::(); + 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::new::()) + self.grow_and_alloc_raw(layout) } as *mut T; unsafe {