From 0c17893d498d30f8a86a97bbc1227852d5e926cd Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 26 Jan 2022 01:35:52 +1100 Subject: [PATCH] Rename `TypedArenaChunk` as `ArenaChunk`. Because it's used within both `TypedArena` and `DroplessArena`. The commit also makes `` the default parameter. --- compiler/rustc_arena/src/lib.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 6f9ecb9cd21..fb93fa152ac 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -45,24 +45,24 @@ pub struct TypedArena { end: Cell<*mut T>, /// A vector of arena chunks. - chunks: RefCell>>, + chunks: RefCell>>, /// Marker indicating that dropping the arena causes its owned /// instances of `T` to be dropped. _own: PhantomData, } -struct TypedArenaChunk { +struct ArenaChunk { /// The raw storage for the arena chunk. storage: Box<[MaybeUninit]>, /// The number of valid entries in the chunk. entries: usize, } -impl TypedArenaChunk { +impl ArenaChunk { #[inline] - unsafe fn new(capacity: usize) -> TypedArenaChunk { - TypedArenaChunk { storage: Box::new_uninit_slice(capacity), entries: 0 } + unsafe fn new(capacity: usize) -> ArenaChunk { + ArenaChunk { storage: Box::new_uninit_slice(capacity), entries: 0 } } /// Destroys this arena chunk. @@ -272,7 +272,7 @@ fn grow(&self, additional: usize) { // Also ensure that this chunk can fit `additional`. new_cap = cmp::max(additional, new_cap); - let mut chunk = TypedArenaChunk::::new(new_cap); + let mut chunk = ArenaChunk::::new(new_cap); self.ptr.set(chunk.start()); self.end.set(chunk.end()); chunks.push(chunk); @@ -281,7 +281,7 @@ fn grow(&self, additional: usize) { // Drops the contents of the last chunk. The last chunk is partially empty, unlike all other // chunks. - fn clear_last_chunk(&self, last_chunk: &mut TypedArenaChunk) { + fn clear_last_chunk(&self, last_chunk: &mut ArenaChunk) { // Determine how much was filled. let start = last_chunk.start() as usize; // We obtain the value of the pointer to the first uninitialized element. @@ -340,7 +340,7 @@ pub struct DroplessArena { end: Cell<*mut u8>, /// A vector of arena chunks. - chunks: RefCell>>, + chunks: RefCell>, } unsafe impl Send for DroplessArena {} @@ -378,7 +378,7 @@ fn grow(&self, additional: usize) { // Also ensure that this chunk can fit `additional`. new_cap = cmp::max(additional, new_cap); - let mut chunk = TypedArenaChunk::::new(new_cap); + let mut chunk = ArenaChunk::new(new_cap); self.start.set(chunk.start()); self.end.set(chunk.end()); chunks.push(chunk);