@@ -31,7 +31,7 @@ use rustc_attr as attr;
3131use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
3232use rustc_data_structures:: profiling:: SelfProfilerRef ;
3333use 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 } ;
3535use rustc_data_structures:: steal:: Steal ;
3636use rustc_data_structures:: sync:: { self , Lock , Lrc , WorkerLocal } ;
3737use rustc_errors:: ErrorReported ;
@@ -966,10 +966,6 @@ pub struct GlobalCtxt<'tcx> {
966966 /// Resolutions of `extern crate` items produced by resolver.
967967 extern_crate_map : FxHashMap < LocalDefId , CrateNum > ,
968968
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-
973969 /// Export map produced by name resolution.
974970 export_map : ExportMap < LocalDefId > ,
975971
@@ -1150,12 +1146,6 @@ impl<'tcx> TyCtxt<'tcx> {
11501146 let common_consts = CommonConsts :: new ( & interners, & common_types) ;
11511147 let cstore = resolutions. cstore ;
11521148
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-
11591149 GlobalCtxt {
11601150 sess : s,
11611151 lint_store,
@@ -1169,7 +1159,6 @@ impl<'tcx> TyCtxt<'tcx> {
11691159 consts : common_consts,
11701160 visibilities : resolutions. visibilities ,
11711161 extern_crate_map : resolutions. extern_crate_map ,
1172- trait_map,
11731162 export_map : resolutions. export_map ,
11741163 maybe_unused_trait_imports : resolutions. maybe_unused_trait_imports ,
11751164 maybe_unused_extern_crates : resolutions. maybe_unused_extern_crates ,
@@ -2662,8 +2651,10 @@ impl<'tcx> TyCtxt<'tcx> {
26622651 struct_lint_level ( self . sess , lint, level, src, None , decorate) ;
26632652 }
26642653
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)
26672658 }
26682659
26692660 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 {
27932784}
27942785
27952786pub 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) ;
27972788 providers. module_exports = |tcx, id| tcx. gcx . export_map . get ( & id) . map ( |v| & v[ ..] ) ;
27982789 providers. crate_name = |tcx, id| {
27992790 assert_eq ! ( id, LOCAL_CRATE ) ;
0 commit comments