@@ -6,7 +6,8 @@ use rustc_attr::{
66 self as attr, ConstStability , DeprecatedSince , Stability , StabilityLevel , StableSince ,
77 Unstable , UnstableReason , VERSION_PLACEHOLDER ,
88} ;
9- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexMap } ;
9+ use rustc_data_structures:: fx:: FxIndexMap ;
10+ use rustc_data_structures:: unord:: { ExtendUnord , UnordMap , UnordSet } ;
1011use rustc_hir as hir;
1112use rustc_hir:: def:: { DefKind , Res } ;
1213use rustc_hir:: def_id:: { LocalDefId , LocalModDefId , CRATE_DEF_ID , LOCAL_CRATE } ;
@@ -923,7 +924,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
923924 }
924925
925926 let declared_lang_features = & tcx. features ( ) . declared_lang_features ;
926- let mut lang_features = FxHashSet :: default ( ) ;
927+ let mut lang_features = UnordSet :: default ( ) ;
927928 for & ( feature, span, since) in declared_lang_features {
928929 if let Some ( since) = since {
929930 // Warn if the user has enabled an already-stable lang feature.
@@ -980,11 +981,11 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
980981 fn check_features < ' tcx > (
981982 tcx : TyCtxt < ' tcx > ,
982983 remaining_lib_features : & mut FxIndexMap < & Symbol , Span > ,
983- remaining_implications : & mut FxHashMap < Symbol , Symbol > ,
984+ remaining_implications : & mut UnordMap < Symbol , Symbol > ,
984985 defined_features : & LibFeatures ,
985- all_implications : & FxHashMap < Symbol , Symbol > ,
986+ all_implications : & UnordMap < Symbol , Symbol > ,
986987 ) {
987- for ( feature, since) in defined_features. to_vec ( ) {
988+ for ( feature, since) in defined_features. to_sorted_vec ( ) {
988989 if let FeatureStability :: AcceptedSince ( since) = since
989990 && let Some ( span) = remaining_lib_features. get ( & feature)
990991 {
@@ -1021,7 +1022,8 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
10211022 // `remaining_lib_features`.
10221023 let mut all_implications = remaining_implications. clone ( ) ;
10231024 for & cnum in tcx. crates ( ( ) ) {
1024- all_implications. extend ( tcx. stability_implications ( cnum) ) ;
1025+ all_implications
1026+ . extend_unord ( tcx. stability_implications ( cnum) . items ( ) . map ( |( k, v) | ( * k, * v) ) ) ;
10251027 }
10261028
10271029 check_features (
@@ -1052,8 +1054,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
10521054
10531055 // We only use the hash map contents to emit errors, and the order of
10541056 // emitted errors do not affect query stability.
1055- #[ allow( rustc:: potential_query_instability) ]
1056- for ( implied_by, feature) in remaining_implications {
1057+ for ( & implied_by, & feature) in remaining_implications. to_sorted_stable_ord ( ) {
10571058 let local_defined_features = tcx. lib_features ( LOCAL_CRATE ) ;
10581059 let span = local_defined_features
10591060 . stability
0 commit comments