Skip to content

Commit 6e85c4e

Browse files
committed
Remove some unused bitset code.
1 parent 2611bf7 commit 6e85c4e

File tree

2 files changed

+0
-79
lines changed

2 files changed

+0
-79
lines changed

compiler/rustc_index/src/bit_set.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -973,48 +973,6 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for ChunkedBitSet<T> {
973973
}
974974
}
975975

976-
impl<T: Idx> BitRelations<ChunkedBitSet<T>> for DenseBitSet<T> {
977-
fn union(&mut self, other: &ChunkedBitSet<T>) -> bool {
978-
sequential_update(|elem| self.insert(elem), other.iter())
979-
}
980-
981-
fn subtract(&mut self, _other: &ChunkedBitSet<T>) -> bool {
982-
unimplemented!("implement if/when necessary");
983-
}
984-
985-
fn intersect(&mut self, other: &ChunkedBitSet<T>) -> bool {
986-
assert_eq!(self.domain_size(), other.domain_size);
987-
let mut changed = false;
988-
for (i, chunk) in other.chunks.iter().enumerate() {
989-
let mut words = &mut self.words[i * CHUNK_WORDS..];
990-
if words.len() > CHUNK_WORDS {
991-
words = &mut words[..CHUNK_WORDS];
992-
}
993-
match chunk {
994-
Zeros => {
995-
for word in words {
996-
if *word != 0 {
997-
changed = true;
998-
*word = 0;
999-
}
1000-
}
1001-
}
1002-
Ones => (),
1003-
Mixed(_, data) => {
1004-
for (i, word) in words.iter_mut().enumerate() {
1005-
let new_val = *word & data[i];
1006-
if new_val != *word {
1007-
changed = true;
1008-
*word = new_val;
1009-
}
1010-
}
1011-
}
1012-
}
1013-
}
1014-
changed
1015-
}
1016-
}
1017-
1018976
impl<T> Clone for ChunkedBitSet<T> {
1019977
fn clone(&self) -> Self {
1020978
ChunkedBitSet {
@@ -1125,15 +1083,6 @@ enum ChunkIter<'a> {
11251083
Finished,
11261084
}
11271085

1128-
// Applies a function to mutate a bitset, and returns true if any
1129-
// of the applications return true
1130-
fn sequential_update<T: Idx>(
1131-
mut self_update: impl FnMut(T) -> bool,
1132-
it: impl Iterator<Item = T>,
1133-
) -> bool {
1134-
it.fold(false, |changed, elem| self_update(elem) | changed)
1135-
}
1136-
11371086
impl<T: Idx> fmt::Debug for ChunkedBitSet<T> {
11381087
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
11391088
w.debug_list().entries(self.iter()).finish()

compiler/rustc_index/src/bit_set/tests.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -306,34 +306,6 @@ fn with_elements_chunked(elements: &[usize], domain_size: usize) -> ChunkedBitSe
306306
s
307307
}
308308

309-
fn with_elements_standard(elements: &[usize], domain_size: usize) -> DenseBitSet<usize> {
310-
let mut s = DenseBitSet::new_empty(domain_size);
311-
for &e in elements {
312-
assert!(s.insert(e));
313-
}
314-
s
315-
}
316-
317-
#[test]
318-
fn chunked_bitset_into_bitset_operations() {
319-
let a = vec![1, 5, 7, 11, 15, 2000, 3000];
320-
let b = vec![3, 4, 11, 3000, 4000];
321-
let aub = vec![1, 3, 4, 5, 7, 11, 15, 2000, 3000, 4000];
322-
let aib = vec![11, 3000];
323-
324-
let b = with_elements_chunked(&b, 9876);
325-
326-
let mut union = with_elements_standard(&a, 9876);
327-
assert!(union.union(&b));
328-
assert!(!union.union(&b));
329-
assert!(union.iter().eq(aub.iter().copied()));
330-
331-
let mut intersection = with_elements_standard(&a, 9876);
332-
assert!(intersection.intersect(&b));
333-
assert!(!intersection.intersect(&b));
334-
assert!(intersection.iter().eq(aib.iter().copied()));
335-
}
336-
337309
#[test]
338310
fn chunked_bitset_iter() {
339311
fn check_iter(bit: &ChunkedBitSet<usize>, vec: &Vec<usize>) {

0 commit comments

Comments
 (0)