From 25407bc0bb2fd4aa2c1a37c81a72084160d097fd Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 20 Sep 2023 07:51:24 +1000 Subject: [PATCH] Make `DroplessArena::alloc` call `DroplessArena::alloc_raw`. They're very similar. --- compiler/rustc_arena/src/lib.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index d793158d85f4..fae147e98b1e 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -501,14 +501,7 @@ impl DroplessArena { assert!(!mem::needs_drop::()); assert!(mem::size_of::() != 0); - 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) - } as *mut T; + let mem = self.alloc_raw(Layout::new::()) as *mut T; unsafe { // Write into uninitialized memory.