Rollup merge of #117863 - nnethercote:rustc_index, r=Mark-Simulacrum

Remove some unused stuff from `rustc_index`

r? `@Mark-Simulacrum`
This commit is contained in:
Takayuki Maeda 2023-11-14 00:54:17 +09:00 committed by GitHub
commit 19bffe1ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 69 deletions

View File

@ -237,23 +237,12 @@ impl<T: Idx> BitSet<T> {
new_word != word
}
/// Gets a slice of the underlying words.
pub fn words(&self) -> &[Word] {
&self.words
}
/// Iterates over the indices of set bits in a sorted order.
#[inline]
pub fn iter(&self) -> BitIter<'_, T> {
BitIter::new(&self.words)
}
/// Duplicates the set as a hybrid set.
pub fn to_hybrid(&self) -> HybridBitSet<T> {
// Note: we currently don't bother trying to make a Sparse set.
HybridBitSet::Dense(self.to_owned())
}
/// Set `self = self | other`. In contrast to `union` returns `true` if the set contains at
/// least one bit that is not in `other` (i.e. `other` is not a superset of `self`).
///
@ -1601,11 +1590,11 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
pub fn from_row_n(row: &BitSet<C>, num_rows: usize) -> BitMatrix<R, C> {
let num_columns = row.domain_size();
let words_per_row = num_words(num_columns);
assert_eq!(words_per_row, row.words().len());
assert_eq!(words_per_row, row.words.len());
BitMatrix {
num_rows,
num_columns,
words: iter::repeat(row.words()).take(num_rows).flatten().cloned().collect(),
words: iter::repeat(&row.words).take(num_rows).flatten().cloned().collect(),
marker: PhantomData,
}
}
@ -1700,9 +1689,9 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
assert_eq!(with.domain_size(), self.num_columns);
let (write_start, write_end) = self.range(write);
let mut changed = false;
for (read_index, write_index) in iter::zip(0..with.words().len(), write_start..write_end) {
for (read_index, write_index) in iter::zip(0..with.words.len(), write_start..write_end) {
let word = self.words[write_index];
let new_word = word | with.words()[read_index];
let new_word = word | with.words[read_index];
self.words[write_index] = new_word;
changed |= word != new_word;
}
@ -2002,54 +1991,6 @@ impl std::fmt::Debug for FiniteBitSet<u32> {
}
}
impl FiniteBitSetTy for u64 {
const DOMAIN_SIZE: u32 = 64;
const FILLED: Self = Self::MAX;
const EMPTY: Self = Self::MIN;
const ONE: Self = 1u64;
const ZERO: Self = 0u64;
fn checked_shl(self, rhs: u32) -> Option<Self> {
self.checked_shl(rhs)
}
fn checked_shr(self, rhs: u32) -> Option<Self> {
self.checked_shr(rhs)
}
}
impl std::fmt::Debug for FiniteBitSet<u64> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:064b}", self.0)
}
}
impl FiniteBitSetTy for u128 {
const DOMAIN_SIZE: u32 = 128;
const FILLED: Self = Self::MAX;
const EMPTY: Self = Self::MIN;
const ONE: Self = 1u128;
const ZERO: Self = 0u128;
fn checked_shl(self, rhs: u32) -> Option<Self> {
self.checked_shl(rhs)
}
fn checked_shr(self, rhs: u32) -> Option<Self> {
self.checked_shr(rhs)
}
}
impl std::fmt::Debug for FiniteBitSet<u128> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{:0128b}", self.0)
}
}
/// A fixed-sized bitset type represented by an integer type. Indices outwith than the range
/// representable by `T` are considered set.
#[derive(Copy, Clone, Eq, PartialEq, Decodable, Encodable)]

View File

@ -137,10 +137,6 @@ impl<I: Idx, T> IndexVec<I, T> {
self.raw.truncate(a)
}
pub fn convert_index_type<Ix: Idx>(self) -> IndexVec<Ix, T> {
IndexVec::from_raw(self.raw)
}
/// Grows the index vector so that it contains an entry for
/// `elem`; if that is already true, then has no
/// effect. Otherwise, inserts new values as needed by invoking

View File

@ -1,5 +1,3 @@
#![allow(dead_code)]
// Allows the macro invocation below to work
use crate as rustc_index;