Skip to content

Commit

Permalink
Fix off-by-one error in DroplessArena::alloc_raw.
Browse files Browse the repository at this point in the history
This causes unnecessary calls to `grow` when the allocation would fit
exactly in the remaining space.
  • Loading branch information
nnethercote committed Jun 8, 2020
1 parent bc10b68 commit 5ceff6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_arena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl DroplessArena {
self.align(align);

let future_end = intrinsics::arith_offset(self.ptr.get(), bytes as isize);
if (future_end as *mut u8) >= self.end.get() {
if (future_end as *mut u8) > self.end.get() {
self.grow(bytes);
}

Expand Down

0 comments on commit 5ceff6b

Please sign in to comment.