@@ -31,7 +31,7 @@ use rustc_attr as attr;
31
31
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
32
32
use rustc_data_structures:: profiling:: SelfProfilerRef ;
33
33
use rustc_data_structures:: sharded:: { IntoPointer , ShardedHashMap } ;
34
- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher , StableVec } ;
34
+ use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
35
35
use rustc_data_structures:: steal:: Steal ;
36
36
use rustc_data_structures:: sync:: { self , Lock , Lrc , WorkerLocal } ;
37
37
use rustc_errors:: ErrorReported ;
@@ -966,10 +966,6 @@ pub struct GlobalCtxt<'tcx> {
966
966
/// Resolutions of `extern crate` items produced by resolver.
967
967
extern_crate_map : FxHashMap < LocalDefId , CrateNum > ,
968
968
969
- /// Map indicating what traits are in scope for places where this
970
- /// is relevant; generated by resolve.
971
- trait_map : FxHashMap < LocalDefId , FxHashMap < ItemLocalId , StableVec < TraitCandidate > > > ,
972
-
973
969
/// Export map produced by name resolution.
974
970
export_map : ExportMap < LocalDefId > ,
975
971
@@ -1150,12 +1146,6 @@ impl<'tcx> TyCtxt<'tcx> {
1150
1146
let common_consts = CommonConsts :: new ( & interners, & common_types) ;
1151
1147
let cstore = resolutions. cstore ;
1152
1148
1153
- let mut trait_map: FxHashMap < _ , FxHashMap < _ , _ > > = FxHashMap :: default ( ) ;
1154
- for ( hir_id, v) in krate. trait_map . iter ( ) {
1155
- let map = trait_map. entry ( hir_id. owner ) . or_default ( ) ;
1156
- map. insert ( hir_id. local_id , StableVec :: new ( v. to_vec ( ) ) ) ;
1157
- }
1158
-
1159
1149
GlobalCtxt {
1160
1150
sess : s,
1161
1151
lint_store,
@@ -1169,7 +1159,6 @@ impl<'tcx> TyCtxt<'tcx> {
1169
1159
consts : common_consts,
1170
1160
visibilities : resolutions. visibilities ,
1171
1161
extern_crate_map : resolutions. extern_crate_map ,
1172
- trait_map,
1173
1162
export_map : resolutions. export_map ,
1174
1163
maybe_unused_trait_imports : resolutions. maybe_unused_trait_imports ,
1175
1164
maybe_unused_extern_crates : resolutions. maybe_unused_extern_crates ,
@@ -2662,8 +2651,10 @@ impl<'tcx> TyCtxt<'tcx> {
2662
2651
struct_lint_level ( self . sess , lint, level, src, None , decorate) ;
2663
2652
}
2664
2653
2665
- pub fn in_scope_traits ( self , id : HirId ) -> Option < & ' tcx StableVec < TraitCandidate > > {
2666
- self . in_scope_traits_map ( id. owner ) . and_then ( |map| map. get ( & id. local_id ) )
2654
+ pub fn in_scope_traits ( self , id : HirId ) -> Option < & ' tcx [ TraitCandidate ] > {
2655
+ let map = self . in_scope_traits_map ( id. owner ) ?;
2656
+ let candidates = map. get ( & id. local_id ) ?;
2657
+ Some ( & * candidates)
2667
2658
}
2668
2659
2669
2660
pub fn named_region ( self , id : HirId ) -> Option < resolve_lifetime:: Region > {
@@ -2793,7 +2784,7 @@ fn ptr_eq<T, U>(t: *const T, u: *const U) -> bool {
2793
2784
}
2794
2785
2795
2786
pub fn provide ( providers : & mut ty:: query:: Providers ) {
2796
- providers. in_scope_traits_map = |tcx, id| tcx. gcx . trait_map . get ( & id) ;
2787
+ providers. in_scope_traits_map = |tcx, id| tcx. hir_crate ( ( ) ) . trait_map . get ( & id) ;
2797
2788
providers. module_exports = |tcx, id| tcx. gcx . export_map . get ( & id) . map ( |v| & v[ ..] ) ;
2798
2789
providers. crate_name = |tcx, id| {
2799
2790
assert_eq ! ( id, LOCAL_CRATE ) ;
0 commit comments