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:
commit
19bffe1ea6
@ -237,23 +237,12 @@ pub fn remove(&mut self, elem: T) -> bool {
|
|||||||
new_word != word
|
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.
|
/// Iterates over the indices of set bits in a sorted order.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn iter(&self) -> BitIter<'_, T> {
|
pub fn iter(&self) -> BitIter<'_, T> {
|
||||||
BitIter::new(&self.words)
|
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
|
/// 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`).
|
/// least one bit that is not in `other` (i.e. `other` is not a superset of `self`).
|
||||||
///
|
///
|
||||||
@ -1601,11 +1590,11 @@ pub fn new(num_rows: usize, num_columns: usize) -> BitMatrix<R, C> {
|
|||||||
pub fn from_row_n(row: &BitSet<C>, num_rows: usize) -> BitMatrix<R, C> {
|
pub fn from_row_n(row: &BitSet<C>, num_rows: usize) -> BitMatrix<R, C> {
|
||||||
let num_columns = row.domain_size();
|
let num_columns = row.domain_size();
|
||||||
let words_per_row = num_words(num_columns);
|
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 {
|
BitMatrix {
|
||||||
num_rows,
|
num_rows,
|
||||||
num_columns,
|
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,
|
marker: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1700,9 +1689,9 @@ pub fn union_row_with(&mut self, with: &BitSet<C>, write: R) -> bool {
|
|||||||
assert_eq!(with.domain_size(), self.num_columns);
|
assert_eq!(with.domain_size(), self.num_columns);
|
||||||
let (write_start, write_end) = self.range(write);
|
let (write_start, write_end) = self.range(write);
|
||||||
let mut changed = false;
|
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 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;
|
self.words[write_index] = new_word;
|
||||||
changed |= word != new_word;
|
changed |= word != new_word;
|
||||||
}
|
}
|
||||||
@ -2002,54 +1991,6 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
/// A fixed-sized bitset type represented by an integer type. Indices outwith than the range
|
||||||
/// representable by `T` are considered set.
|
/// representable by `T` are considered set.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Decodable, Encodable)]
|
#[derive(Copy, Clone, Eq, PartialEq, Decodable, Encodable)]
|
||||||
|
@ -137,10 +137,6 @@ pub fn truncate(&mut self, a: usize) {
|
|||||||
self.raw.truncate(a)
|
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
|
/// Grows the index vector so that it contains an entry for
|
||||||
/// `elem`; if that is already true, then has no
|
/// `elem`; if that is already true, then has no
|
||||||
/// effect. Otherwise, inserts new values as needed by invoking
|
/// effect. Otherwise, inserts new values as needed by invoking
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#![allow(dead_code)]
|
|
||||||
|
|
||||||
// Allows the macro invocation below to work
|
// Allows the macro invocation below to work
|
||||||
use crate as rustc_index;
|
use crate as rustc_index;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user