Replace a number of FxHashMaps/Sets with stable-iteration-order alternatives.
This commit is contained in:
parent
739e5ef49e
commit
db132c575d
9 changed files with 40 additions and 33 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -61,7 +61,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
|
|||
use rustc_data_structures::steal::Steal;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::unord::UnordSet;
|
||||
use rustc_data_structures::unord::{UnordMap, UnordSet};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::{DefKind, DocLinkResMap};
|
||||
|
@ -1739,7 +1739,7 @@ rustc_queries! {
|
|||
separate_provide_extern
|
||||
arena_cache
|
||||
}
|
||||
query stability_implications(_: CrateNum) -> &'tcx FxHashMap<Symbol, Symbol> {
|
||||
query stability_implications(_: CrateNum) -> &'tcx UnordMap<Symbol, Symbol> {
|
||||
arena_cache
|
||||
desc { "calculating the implications between `#[unstable]` features defined in a crate" }
|
||||
separate_provide_extern
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue