diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2023-12-21 10:52:27 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2024-01-04 13:32:42 +0100 |
| commit | db132c575d1950c84d58009db922b6cbfe7a1918 (patch) | |
| tree | 09050bcb961cc09fe29ae348dabdd003062c9e39 /compiler/rustc_middle/src/middle/mod.rs | |
| parent | 739e5ef49e28ea4b2ab20bd28251a2299bd6889c (diff) | |
| download | rust-db132c575d1950c84d58009db922b6cbfe7a1918.tar.gz rust-db132c575d1950c84d58009db922b6cbfe7a1918.zip | |
Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives.
Diffstat (limited to 'compiler/rustc_middle/src/middle/mod.rs')
| -rw-r--r-- | compiler/rustc_middle/src/middle/mod.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/middle/mod.rs b/compiler/rustc_middle/src/middle/mod.rs index 8c1b1ff12e9..bdb2270611a 100644 --- a/compiler/rustc_middle/src/middle/mod.rs +++ b/compiler/rustc_middle/src/middle/mod.rs @@ -4,7 +4,7 @@ pub mod dependency_format; pub mod exported_symbols; pub mod lang_items; pub mod lib_features { - use rustc_data_structures::fx::FxHashMap; + use rustc_data_structures::unord::UnordMap; use rustc_span::{symbol::Symbol, Span}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] @@ -16,15 +16,16 @@ pub mod lib_features { #[derive(HashStable, Debug, Default)] pub struct LibFeatures { - pub stability: FxHashMap<Symbol, (FeatureStability, Span)>, + pub stability: UnordMap<Symbol, (FeatureStability, Span)>, } impl LibFeatures { - pub fn to_vec(&self) -> Vec<(Symbol, FeatureStability)> { - let mut all_features: Vec<_> = - self.stability.iter().map(|(&sym, &(stab, _))| (sym, stab)).collect(); - all_features.sort_unstable_by(|(a, _), (b, _)| a.as_str().cmp(b.as_str())); - all_features + pub fn to_sorted_vec(&self) -> Vec<(Symbol, FeatureStability)> { + self.stability + .to_sorted_stable_ord() + .iter() + .map(|(&sym, &(stab, _))| (sym, stab)) + .collect() } } } |
