diff options
| author | pierwill <pierwill@users.noreply.github.com> | 2021-12-07 11:03:53 -0600 |
|---|---|---|
| committer | pierwill <pierwill@users.noreply.github.com> | 2021-12-22 10:50:57 -0600 |
| commit | a4a8c241c7bcce3604a0ce130a65084101d0ab47 (patch) | |
| tree | 34c3affd87378aa46e9200afbb4e1c48d89a2585 | |
| parent | 8df92485919ac660273ec8dfef61d7ebb0b67a86 (diff) | |
Require Ord for rustc_index::SparseBitSet::last_set_in
| -rw-r--r-- | compiler/rustc_index/src/bit_set.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs index e2f2324f4a8..5aa213cb701 100644 --- a/compiler/rustc_index/src/bit_set.rs +++ b/compiler/rustc_index/src/bit_set.rs @@ -715,6 +715,10 @@ impl<T: Idx> SparseBitSet<T> { self.elems.iter() } + bit_relations_inherent_impls! {} +} + +impl<T: Idx + Ord> SparseBitSet<T> { fn last_set_in(&self, range: impl RangeBounds<T>) -> Option<T> { let mut last_leq = None; for e in self.iter() { @@ -724,8 +728,6 @@ impl<T: Idx> SparseBitSet<T> { } last_leq } - - bit_relations_inherent_impls! {} } /// 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`, /// inclusively of elem. That is, will return `Some(elem)` if elem is in the /// 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 { HybridBitSet::Sparse(sparse) => sparse.last_set_in(range), HybridBitSet::Dense(dense) => dense.last_set_in(range), |
