diff options
Diffstat (limited to 'compiler/rustc_data_structures/src/unord.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/unord.rs | 8 |
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 6c8d5414631..e18c7b415f6 100644 --- a/compiler/rustc_data_structures/src/unord.rs +++ b/compiler/rustc_data_structures/src/unord.rs @@ -140,12 +140,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() @@ -161,6 +161,10 @@ impl<T: Ord, I: Iterator<Item = T>> UnordItems<T, I> { items.sort_by_cached_key(|x| x.to_stable_hash_key(hcx)); items } + + pub fn collect<C: From<UnordItems<T, I>>>(self) -> C { + self.into() + } } /// This is a set collection type that tries very hard to not expose |
