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 | |
| 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')
| -rw-r--r-- | compiler/rustc_middle/src/middle/mod.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/middle/stability.rs | 3 |
2 files changed, 10 insertions, 8 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() } } } diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index b2d1124b2ed..04b5af4d8a7 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -9,6 +9,7 @@ use rustc_attr::{ self as attr, ConstStability, DefaultBodyStability, DeprecatedSince, Deprecation, Stability, }; use rustc_data_structures::fx::FxHashMap; +use rustc_data_structures::unord::UnordMap; use rustc_errors::{Applicability, Diagnostic}; use rustc_feature::GateIssue; use rustc_hir::def::DefKind; @@ -77,7 +78,7 @@ pub struct Index { /// to know that the feature implies another feature. If it were reversed, and the `#[stable]` /// attribute had an `implies` meta item, then a map would be necessary when avoiding a "use of /// unstable feature" error for a feature that was implied. - pub implications: FxHashMap<Symbol, Symbol>, + pub implications: UnordMap<Symbol, Symbol>, } impl Index { |
