summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_data_structures/src/unord.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_data_structures/src/unord.rs')
-rw-r--r--compiler/rustc_data_structures/src/unord.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_data_structures/src/unord.rs b/compiler/rustc_data_structures/src/unord.rs
index 6c8d54146..2b21815b6 100644
--- a/compiler/rustc_data_structures/src/unord.rs
+++ b/compiler/rustc_data_structures/src/unord.rs
@@ -107,6 +107,10 @@ impl<T, I: Iterator<Item = T>> UnordItems<T, I> {
{
UnordItems(self.0.flat_map(f))
}
+
+ pub fn collect<C: From<UnordItems<T, I>>>(self) -> C {
+ self.into()
+ }
}
impl<T> UnordItems<T, std::iter::Empty<T>> {
@@ -140,12 +144,12 @@ impl<T: Ord, I: Iterator<Item = T>> UnordItems<T, I> {
}
#[inline]
- pub fn into_sorted_stable_ord(self, use_stable_sort: bool) -> Vec<T>
+ pub fn into_sorted_stable_ord(self) -> Vec<T>
where
T: Ord + StableOrd,
{
let mut items: Vec<T> = self.0.collect();
- if use_stable_sort {
+ if !T::CAN_USE_UNSTABLE_SORT {
items.sort();
} else {
items.sort_unstable()