about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorMichael Woerister <michaelwoerister@posteo>2023-12-21 10:27:34 +0100
committerMichael Woerister <michaelwoerister@posteo>2024-01-04 13:32:42 +0100
commit739e5ef49e28ea4b2ab20bd28251a2299bd6889c (patch)
tree442c90e4c8b53e88e99636f8ef509394ed8936ae /compiler/rustc_middle
parent090d5eac722000906cc00d991f2bf052b0e388c3 (diff)
downloadrust-739e5ef49e28ea4b2ab20bd28251a2299bd6889c.tar.gz
rust-739e5ef49e28ea4b2ab20bd28251a2299bd6889c.zip
Split StableCompare trait out of StableOrd trait.
StableCompare is a companion trait to `StableOrd`. Some types like `Symbol` can be compared in a cross-session stable way, but their `Ord` implementation is not stable. In such cases, a `StableOrd` implementation can be provided to offer a lightweight way for stable sorting. (The more heavyweight option is to sort via `ToStableHashKey`, but then sorting needs to have access to a stable hashing context and `ToStableHashKey` can also be expensive as in the case of `Symbol` where it has to allocate a `String`.)
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/typeck_results.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/typeck_results.rs b/compiler/rustc_middle/src/ty/typeck_results.rs
index 58699c934b6..ad41a674dd8 100644
--- a/compiler/rustc_middle/src/ty/typeck_results.rs
+++ b/compiler/rustc_middle/src/ty/typeck_results.rs
@@ -527,7 +527,7 @@ impl<'a, V> LocalTableInContext<'a, V> {
     }
 
     pub fn items_in_stable_order(&self) -> Vec<(ItemLocalId, &'a V)> {
-        self.data.to_sorted_stable_ord()
+        self.data.items().map(|(&k, v)| (k, v)).into_sorted_stable_ord_by_key(|(k, _)| k)
     }
 }