mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 04:56:25 +03:00
Fix TypedArena infinitely looping when inplace reallocation fails.
This commit is contained in:
+2
-2
@@ -196,9 +196,9 @@ fn grow(&self, n: usize) {
|
||||
self.end.set(last_chunk.end());
|
||||
return;
|
||||
} else {
|
||||
let prev_capacity = last_chunk.storage.cap();
|
||||
new_capacity = last_chunk.storage.cap();
|
||||
loop {
|
||||
new_capacity = prev_capacity.checked_mul(2).unwrap();
|
||||
new_capacity = new_capacity.checked_mul(2).unwrap();
|
||||
if new_capacity >= currently_used_cap + n {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user