Skip to content

Commit a4a8c24

Browse files
committed
Require Ord for rustc_index::SparseBitSet::last_set_in
1 parent 8df9248 commit a4a8c24

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Diff for: compiler/rustc_index/src/bit_set.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,10 @@ impl<T: Idx> SparseBitSet<T> {
715715
self.elems.iter()
716716
}
717717

718+
bit_relations_inherent_impls! {}
719+
}
720+
721+
impl<T: Idx + Ord> SparseBitSet<T> {
718722
fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T> {
719723
let mut last_leq = None;
720724
for e in self.iter() {
@@ -724,8 +728,6 @@ impl<T: Idx> SparseBitSet<T> {
724728
}
725729
last_leq
726730
}
727-
728-
bit_relations_inherent_impls! {}
729731
}
730732

731733
/// A fixed-size bitset type with a hybrid representation: sparse when there
@@ -802,7 +804,10 @@ impl<T: Idx> HybridBitSet<T> {
802804
/// Returns the previous element present in the bitset from `elem`,
803805
/// inclusively of elem. That is, will return `Some(elem)` if elem is in the
804806
/// bitset.
805-
pub fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T> {
807+
pub fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T>
808+
where
809+
T: Ord,
810+
{
806811
match self {
807812
HybridBitSet::Sparse(sparse) => sparse.last_set_in(range),
808813
HybridBitSet::Dense(dense) => dense.last_set_in(range),

0 commit comments

Comments
 (0)