Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6cf3786

Browse files
committed
Fix HybridBitSet port issue
1 parent 79e0a0f commit 6cf3786

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

compiler/rustc_index/src/bit_set.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,13 @@ impl<T: Idx> BitRelations<BitSet<T>> for BitSet<T> {
247247
}
248248
}
249249

250-
fn sequential_update<T: Idx>(mut f: impl FnMut(T) -> bool, it: impl Iterator<Item = T>) -> bool {
250+
fn sequential_update<T: Idx>(
251+
mut self_update: impl FnMut(T) -> bool,
252+
it: impl Iterator<Item = T>,
253+
) -> bool {
251254
let mut changed = false;
252255
for elem in it {
253-
changed |= f(elem);
256+
changed |= self_update(elem);
254257
}
255258
changed
256259
}
@@ -342,7 +345,17 @@ impl<T: Idx> BitRelations<HybridBitSet<T>> for HybridBitSet<T> {
342345
match self {
343346
HybridBitSet::Sparse(self_sparse) => {
344347
match other {
345-
HybridBitSet::Sparse(other_sparse) => self_sparse.union(other_sparse),
348+
HybridBitSet::Sparse(other_sparse) => {
349+
// Both sets are sparse. Add the elements in
350+
// `other_sparse` to `self` one at a time. This
351+
// may or may not cause `self` to be densified.
352+
assert_eq!(self.domain_size(), other.domain_size());
353+
let mut changed = false;
354+
for elem in other_sparse.iter() {
355+
changed |= self.insert(*elem);
356+
}
357+
changed
358+
}
346359

347360
HybridBitSet::Dense(other_dense) => {
348361
// `self` is sparse and `other` is dense. To

0 commit comments

Comments
 (0)