mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Require Ord for rustc_index::SparseBitSet::last_set_in
This commit is contained in:
parent
8df9248591
commit
a4a8c241c7
@ -715,6 +715,10 @@ impl<T: Idx> SparseBitSet<T> {
|
|||||||
self.elems.iter()
|
self.elems.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bit_relations_inherent_impls! {}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Idx + Ord> SparseBitSet<T> {
|
||||||
fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T> {
|
fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T> {
|
||||||
let mut last_leq = None;
|
let mut last_leq = None;
|
||||||
for e in self.iter() {
|
for e in self.iter() {
|
||||||
@ -724,8 +728,6 @@ impl<T: Idx> SparseBitSet<T> {
|
|||||||
}
|
}
|
||||||
last_leq
|
last_leq
|
||||||
}
|
}
|
||||||
|
|
||||||
bit_relations_inherent_impls! {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A fixed-size bitset type with a hybrid representation: sparse when there
|
/// A fixed-size bitset type with a hybrid representation: sparse when there
|
||||||
@ -802,7 +804,10 @@ impl<T: Idx> HybridBitSet<T> {
|
|||||||
/// Returns the previous element present in the bitset from `elem`,
|
/// Returns the previous element present in the bitset from `elem`,
|
||||||
/// inclusively of elem. That is, will return `Some(elem)` if elem is in the
|
/// inclusively of elem. That is, will return `Some(elem)` if elem is in the
|
||||||
/// bitset.
|
/// bitset.
|
||||||
pub fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T> {
|
pub fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T>
|
||||||
|
where
|
||||||
|
T: Ord,
|
||||||
|
{
|
||||||
match self {
|
match self {
|
||||||
HybridBitSet::Sparse(sparse) => sparse.last_set_in(range),
|
HybridBitSet::Sparse(sparse) => sparse.last_set_in(range),
|
||||||
HybridBitSet::Dense(dense) => dense.last_set_in(range),
|
HybridBitSet::Dense(dense) => dense.last_set_in(range),
|
||||||
|
Loading…
Reference in New Issue
Block a user