@@ -35,7 +35,6 @@ use crate::ty::{InferTy, ParamTy, PolyFnSig, ProjectionTy};
3535use crate :: ty:: { List , TyKind , TyS } ;
3636use rustc_ast:: ast;
3737use rustc_ast:: expand:: allocator:: AllocatorKind ;
38- use rustc_ast:: node_id:: NodeMap ;
3938use rustc_attr as attr;
4039use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
4140use rustc_data_structures:: profiling:: SelfProfilerRef ;
@@ -926,7 +925,7 @@ pub struct GlobalCtxt<'tcx> {
926925 pub consts : CommonConsts < ' tcx > ,
927926
928927 /// Resolutions of `extern crate` items produced by resolver.
929- extern_crate_map : NodeMap < CrateNum > ,
928+ extern_crate_map : FxHashMap < DefId , CrateNum > ,
930929
931930 /// Map indicating what traits are in scope for places where this
932931 /// is relevant; generated by resolve.
@@ -1116,13 +1115,8 @@ impl<'tcx> TyCtxt<'tcx> {
11161115 } ;
11171116
11181117 let mut trait_map: FxHashMap < _ , FxHashMap < _ , _ > > = FxHashMap :: default ( ) ;
1119- for ( k, v) in resolutions. trait_map {
1120- let hir_id = definitions. node_id_to_hir_id ( k) ;
1118+ for ( hir_id, v) in resolutions. trait_map . into_iter ( ) {
11211119 let map = trait_map. entry ( hir_id. owner ) . or_default ( ) ;
1122- let v = v
1123- . into_iter ( )
1124- . map ( |tc| tc. map_import_ids ( |id| definitions. node_id_to_hir_id ( id) ) )
1125- . collect ( ) ;
11261120 map. insert ( hir_id. local_id , StableVec :: new ( v) ) ;
11271121 }
11281122
@@ -1139,32 +1133,10 @@ impl<'tcx> TyCtxt<'tcx> {
11391133 consts : common_consts,
11401134 extern_crate_map : resolutions. extern_crate_map ,
11411135 trait_map,
1142- export_map : resolutions
1143- . export_map
1144- . into_iter ( )
1145- . map ( |( k, v) | {
1146- let exports: Vec < _ > = v
1147- . into_iter ( )
1148- . map ( |e| e. map_id ( |id| definitions. node_id_to_hir_id ( id) ) )
1149- . collect ( ) ;
1150- ( k, exports)
1151- } )
1152- . collect ( ) ,
1153- maybe_unused_trait_imports : resolutions
1154- . maybe_unused_trait_imports
1155- . into_iter ( )
1156- . map ( |id| definitions. local_def_id ( id) )
1157- . collect ( ) ,
1158- maybe_unused_extern_crates : resolutions
1159- . maybe_unused_extern_crates
1160- . into_iter ( )
1161- . map ( |( id, sp) | ( definitions. local_def_id ( id) . to_def_id ( ) , sp) )
1162- . collect ( ) ,
1163- glob_map : resolutions
1164- . glob_map
1165- . into_iter ( )
1166- . map ( |( id, names) | ( definitions. local_def_id ( id) , names) )
1167- . collect ( ) ,
1136+ export_map : resolutions. export_map ,
1137+ maybe_unused_trait_imports : resolutions. maybe_unused_trait_imports ,
1138+ maybe_unused_extern_crates : resolutions. maybe_unused_extern_crates ,
1139+ glob_map : resolutions. glob_map ,
11681140 extern_prelude : resolutions. extern_prelude ,
11691141 untracked_crate : krate,
11701142 definitions,
@@ -2729,10 +2701,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
27292701 let id = tcx. hir ( ) . local_def_id_to_hir_id ( id. expect_local ( ) ) ;
27302702 tcx. stability ( ) . local_deprecation_entry ( id)
27312703 } ;
2732- providers. extern_mod_stmt_cnum = |tcx, id| {
2733- let id = tcx. hir ( ) . as_local_node_id ( id) . unwrap ( ) ;
2734- tcx. extern_crate_map . get ( & id) . cloned ( )
2735- } ;
2704+ providers. extern_mod_stmt_cnum = |tcx, id| tcx. extern_crate_map . get ( & id) . cloned ( ) ;
27362705 providers. all_crate_nums = |tcx, cnum| {
27372706 assert_eq ! ( cnum, LOCAL_CRATE ) ;
27382707 tcx. arena . alloc_slice ( & tcx. cstore . crates_untracked ( ) )
0 commit comments