@@ -35,7 +35,6 @@ use crate::ty::{InferTy, ParamTy, PolyFnSig, ProjectionTy};
35
35
use crate :: ty:: { List , TyKind , TyS } ;
36
36
use rustc_ast:: ast;
37
37
use rustc_ast:: expand:: allocator:: AllocatorKind ;
38
- use rustc_ast:: node_id:: NodeMap ;
39
38
use rustc_attr as attr;
40
39
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
41
40
use rustc_data_structures:: profiling:: SelfProfilerRef ;
@@ -926,7 +925,7 @@ pub struct GlobalCtxt<'tcx> {
926
925
pub consts : CommonConsts < ' tcx > ,
927
926
928
927
/// Resolutions of `extern crate` items produced by resolver.
929
- extern_crate_map : NodeMap < CrateNum > ,
928
+ extern_crate_map : FxHashMap < DefId , CrateNum > ,
930
929
931
930
/// Map indicating what traits are in scope for places where this
932
931
/// is relevant; generated by resolve.
@@ -1116,13 +1115,8 @@ impl<'tcx> TyCtxt<'tcx> {
1116
1115
} ;
1117
1116
1118
1117
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 ( ) {
1121
1119
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 ( ) ;
1126
1120
map. insert ( hir_id. local_id , StableVec :: new ( v) ) ;
1127
1121
}
1128
1122
@@ -1139,32 +1133,10 @@ impl<'tcx> TyCtxt<'tcx> {
1139
1133
consts : common_consts,
1140
1134
extern_crate_map : resolutions. extern_crate_map ,
1141
1135
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 ,
1168
1140
extern_prelude : resolutions. extern_prelude ,
1169
1141
untracked_crate : krate,
1170
1142
definitions,
@@ -2729,10 +2701,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
2729
2701
let id = tcx. hir ( ) . local_def_id_to_hir_id ( id. expect_local ( ) ) ;
2730
2702
tcx. stability ( ) . local_deprecation_entry ( id)
2731
2703
} ;
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 ( ) ;
2736
2705
providers. all_crate_nums = |tcx, cnum| {
2737
2706
assert_eq ! ( cnum, LOCAL_CRATE ) ;
2738
2707
tcx. arena . alloc_slice ( & tcx. cstore . crates_untracked ( ) )
0 commit comments