diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-09-20 07:51:24 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-09-28 15:44:48 +1000 |
| commit | 25407bc0bb2fd4aa2c1a37c81a72084160d097fd (patch) | |
| tree | 2d3865dbd05d5775c5d3b120f01843cd699a7db7 | |
| parent | 98d97b7323a55fce821bab6606bf216dbb97523a (diff) | |
| download | rust-25407bc0bb2fd4aa2c1a37c81a72084160d097fd.tar.gz rust-25407bc0bb2fd4aa2c1a37c81a72084160d097fd.zip | |
Make `DroplessArena::alloc` call `DroplessArena::alloc_raw`.
They're very similar.
| -rw-r--r-- | compiler/rustc_arena/src/lib.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index d793158d85f..fae147e98b1 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::<T>()); assert!(mem::size_of::<T>() != 0); - let layout = Layout::new::<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; + let mem = self.alloc_raw(Layout::new::<T>()) as *mut T; unsafe { // Write into uninitialized memory. |
