diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-09-19 17:08:13 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-09-28 15:44:48 +1000 |
| commit | 79b11f0802a17f5fce65e22b4934104d40a10e93 (patch) | |
| tree | 054750af6fed9c0b3e30dbcdcd7e49d56c22e334 /compiler/rustc_arena | |
| parent | 2ba4eb2d49e774b5fbc2a06258ac7b0f60b92b7e (diff) | |
| download | rust-79b11f0802a17f5fce65e22b4934104d40a10e93.tar.gz rust-79b11f0802a17f5fce65e22b4934104d40a10e93.zip | |
rustc_arena: tweak some comments.
Diffstat (limited to 'compiler/rustc_arena')
| -rw-r--r-- | compiler/rustc_arena/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_arena/src/lib.rs b/compiler/rustc_arena/src/lib.rs index 23fdd272ffd..2f0be3f3e4e 100644 --- a/compiler/rustc_arena/src/lib.rs +++ b/compiler/rustc_arena/src/lib.rs @@ -407,6 +407,8 @@ impl Default for DroplessArena { #[inline] fn default() -> DroplessArena { DroplessArena { + // We set both `start` and `end` to 0 so that the first call to + // alloc() will trigger a grow(). start: Cell::new(ptr::null_mut()), end: Cell::new(ptr::null_mut()), chunks: Default::default(), @@ -417,7 +419,7 @@ impl Default for DroplessArena { impl DroplessArena { fn grow(&self, layout: Layout) { // Add some padding so we can align `self.end` while - // stilling fitting in a `layout` allocation. + // still fitting in a `layout` allocation. let additional = layout.size() + cmp::max(DROPLESS_ALIGNMENT, layout.align()) - 1; unsafe { @@ -441,7 +443,7 @@ impl DroplessArena { let mut chunk = ArenaChunk::new(align_up(new_cap, PAGE)); self.start.set(chunk.start()); - // Align the end to DROPLESS_ALIGNMENT + // Align the end to DROPLESS_ALIGNMENT. let end = align_down(chunk.end().addr(), DROPLESS_ALIGNMENT); // Make sure we don't go past `start`. This should not happen since the allocation |
