@@ -6,7 +6,7 @@ use std::ops::{Deref, DerefMut};
66use rustc_abi:: { ExternAbi , Size } ;
77use rustc_apfloat:: Float ;
88use rustc_apfloat:: ieee:: { Double , Half , Quad , Single } ;
9- use rustc_data_structures:: fx:: { FxIndexMap , IndexEntry } ;
9+ use rustc_data_structures:: fx:: { FxHashMap , FxIndexMap } ;
1010use rustc_data_structures:: unord:: UnordMap ;
1111use rustc_hir as hir;
1212use rustc_hir:: LangItem ;
@@ -3489,8 +3489,8 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
34893489
34903490 // Once constructed, unique namespace+symbol pairs will have a `Some(_)` entry, while
34913491 // non-unique pairs will have a `None` entry.
3492- let unique_symbols_rev: & mut FxIndexMap < ( Namespace , Symbol ) , Option < DefId > > =
3493- & mut FxIndexMap :: default ( ) ;
3492+ let unique_symbols_rev: & mut FxHashMap < ( Namespace , Symbol ) , Option < DefId > > =
3493+ & mut FxHashMap :: default ( ) ;
34943494
34953495 for symbol_set in tcx. resolutions ( ( ) ) . glob_map . values ( ) {
34963496 for symbol in symbol_set {
@@ -3500,23 +3500,29 @@ pub fn trimmed_def_paths(tcx: TyCtxt<'_>, (): ()) -> DefIdMap<Symbol> {
35003500 }
35013501 }
35023502
3503- for_each_def ( tcx, |ident, ns, def_id| match unique_symbols_rev. entry ( ( ns, ident. name ) ) {
3504- IndexEntry :: Occupied ( mut v) => match v. get ( ) {
3505- None => { }
3506- Some ( existing) => {
3507- if * existing != def_id {
3508- v. insert ( None ) ;
3503+ for_each_def ( tcx, |ident, ns, def_id| {
3504+ use std:: collections:: hash_map:: Entry :: { Occupied , Vacant } ;
3505+
3506+ match unique_symbols_rev. entry ( ( ns, ident. name ) ) {
3507+ Occupied ( mut v) => match v. get ( ) {
3508+ None => { }
3509+ Some ( existing) => {
3510+ if * existing != def_id {
3511+ v. insert ( None ) ;
3512+ }
35093513 }
3514+ } ,
3515+ Vacant ( v) => {
3516+ v. insert ( Some ( def_id) ) ;
35103517 }
3511- } ,
3512- IndexEntry :: Vacant ( v) => {
3513- v. insert ( Some ( def_id) ) ;
35143518 }
35153519 } ) ;
35163520
35173521 // Put the symbol from all the unique namespace+symbol pairs into `map`.
35183522 let mut map: DefIdMap < Symbol > = Default :: default ( ) ;
3519- for ( ( _, symbol) , opt_def_id) in unique_symbols_rev. drain ( ..) {
3523+ // Precatious is taken below in the loop so we can allow this lint here.
3524+ #[ allow( rustc:: potential_query_instability) ]
3525+ for ( ( _, symbol) , opt_def_id) in unique_symbols_rev. drain ( ) {
35203526 use std:: collections:: hash_map:: Entry :: { Occupied , Vacant } ;
35213527
35223528 if let Some ( def_id) = opt_def_id {
0 commit comments