Skip to content

Commit 9d4cb0c

Browse files
Auto merge of #147623 - Zalathar:clear-mixed, r=<try>
Clear `ChunkedBitSet` without reallocating
2 parents 2300c2a + 279a5b3 commit 9d4cb0c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compiler/rustc_index/src/bit_set.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,7 @@ impl<T: Idx> ChunkedBitSet<T> {
585585
}
586586

587587
pub fn clear(&mut self) {
588-
let domain_size = self.domain_size();
589-
*self = ChunkedBitSet::new_empty(domain_size);
588+
self.chunks.fill_with(|| Chunk::Zeros);
590589
}
591590

592591
#[cfg(test)]

0 commit comments

Comments
 (0)