Skip to content

Commit a0b5647

Browse files
Tage Johanssonlqd
Tage Johansson
authored andcommitted
Use the new bincode encoding for DenseBitSet.
1 parent e35fb55 commit a0b5647

File tree

3 files changed

+1
-506
lines changed

3 files changed

+1
-506
lines changed

compiler/rustc_index/src/bit_set.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#![expect(unreachable_pub)]
2-
#![allow(dead_code)]
31
mod dense_bit_set;
4-
mod old_dense_bit_set;
52
use std::marker::PhantomData;
63
#[cfg(not(feature = "nightly"))]
74
use std::mem;
@@ -10,8 +7,7 @@ use std::rc::Rc;
107
use std::{fmt, iter};
118

129
use Chunk::*;
13-
pub use dense_bit_set::BitIter;
14-
pub use old_dense_bit_set::{DenseBitSet, GrowableBitSet};
10+
pub use dense_bit_set::{BitIter, DenseBitSet, GrowableBitSet};
1511
#[cfg(feature = "nightly")]
1612
use rustc_macros::{Decodable_NoContext, Encodable_NoContext};
1713
use smallvec::{SmallVec, smallvec};

compiler/rustc_index/src/bit_set/dense_bit_set.rs

-20
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use std::{fmt, iter, slice};
1010
use itertools::Either;
1111
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
1212

13-
use super::old_dense_bit_set::DenseBitSet as OldDenseBitSet;
1413
use super::{
1514
BitRelations, CHUNK_WORDS, Chunk, ChunkedBitSet, WORD_BITS, Word, word_index_and_mask,
1615
};
@@ -781,7 +780,6 @@ impl<T: Idx> BitRelations<ChunkedBitSet<T>> for DenseBitSet<T> {
781780
impl<S: Encoder, T> Encodable<S> for DenseBitSet<T> {
782781
#[inline(never)] // FIXME: For profiling purposes
783782
fn encode(&self, s: &mut S) {
784-
/* FIXME: This is new incompatable encoding
785783
// The encoding is as follows:
786784
//
787785
// The `inline` and `empty_unallocated` variants are encoded as a single `Word`. Here, we
@@ -810,21 +808,12 @@ impl<S: Encoder, T> Encodable<S> for DenseBitSet<T> {
810808
debug_assert!(word >> WORD_BITS - 2 != 0, "the 2 most significant bits must not be 0");
811809
word.encode(s);
812810
}
813-
*/
814-
815-
// Old compatable encoding.
816-
let mut old_set = OldDenseBitSet::<usize>::new_empty(self.capacity());
817-
for x in self.iter_usizes() {
818-
old_set.insert(x);
819-
}
820-
old_set.encode(s);
821811
}
822812
}
823813

824814
impl<D: Decoder, T> Decodable<D> for DenseBitSet<T> {
825815
#[inline(never)] // FIXME: For profiling purposes
826816
fn decode(d: &mut D) -> Self {
827-
/* FIXME: This is new incompatable decoding.
828817
// First we read one `Word` and check the variant.
829818
let word = Word::decode(d);
830819
if word >> WORD_BITS - 2 == 0x0 {
@@ -853,15 +842,6 @@ impl<D: Decoder, T> Decodable<D> for DenseBitSet<T> {
853842
// and the union is `repr(C)`.
854843
Self { inline: word }
855844
}
856-
*/
857-
858-
// Old compatable decoding.
859-
let old_set = OldDenseBitSet::<usize>::decode(d);
860-
let mut set = Self::new_empty(old_set.domain_size());
861-
for x in old_set.iter() {
862-
set.insert_usize(x);
863-
}
864-
set
865845
}
866846
}
867847

0 commit comments

Comments
 (0)