summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_data_structures/src/unord.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:31 +0000
commitdc0db358abe19481e475e10c32149b53370f1a1c (patch)
treeab8ce99c4b255ce46f99ef402c27916055b899ee /compiler/rustc_data_structures/src/unord.rs
parentReleasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff)
downloadrustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz
rustc-dc0db358abe19481e475e10c32149b53370f1a1c.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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()