@@ -14,8 +14,8 @@ use dep_graph::DepGraph;
14
14
use errors:: DiagnosticBuilder ;
15
15
use session:: Session ;
16
16
use middle;
17
- use hir:: { TraitMap } ;
18
- use hir:: def:: { Def , ExportMap } ;
17
+ use hir:: { TraitCandidate , HirId } ;
18
+ use hir:: def:: { Def , Export } ;
19
19
use hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
20
20
use hir:: map as hir_map;
21
21
use hir:: map:: DefPathHash ;
@@ -817,10 +817,10 @@ pub struct GlobalCtxt<'tcx> {
817
817
818
818
/// Map indicating what traits are in scope for places where this
819
819
/// is relevant; generated by resolve.
820
- pub trait_map : TraitMap ,
820
+ trait_map : FxHashMap < HirId , Rc < Vec < TraitCandidate > > > ,
821
821
822
822
/// Export map produced by name resolution.
823
- pub export_map : ExportMap ,
823
+ export_map : FxHashMap < HirId , Rc < Vec < Export > > > ,
824
824
825
825
pub named_region_map : resolve_lifetime:: NamedRegionMap ,
826
826
@@ -1075,8 +1075,12 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
1075
1075
dep_graph : dep_graph. clone ( ) ,
1076
1076
types : common_types,
1077
1077
named_region_map,
1078
- trait_map : resolutions. trait_map ,
1079
- export_map : resolutions. export_map ,
1078
+ trait_map : resolutions. trait_map . into_iter ( ) . map ( |( k, v) | {
1079
+ ( hir. node_to_hir_id ( k) , Rc :: new ( v) )
1080
+ } ) . collect ( ) ,
1081
+ export_map : resolutions. export_map . into_iter ( ) . map ( |( k, v) | {
1082
+ ( hir. node_to_hir_id ( k) , Rc :: new ( v) )
1083
+ } ) . collect ( ) ,
1080
1084
hir,
1081
1085
def_path_hash_to_def_id,
1082
1086
maps : maps:: Maps :: new ( providers) ,
@@ -1994,3 +1998,20 @@ impl<T, R, E> InternIteratorElement<T, R> for Result<T, E> {
1994
1998
Ok ( f ( & iter. collect :: < Result < AccumulateVec < [ _ ; 8 ] > , _ > > ( ) ?) )
1995
1999
}
1996
2000
}
2001
+
2002
+ fn in_scope_traits < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , id : HirId )
2003
+ -> Option < Rc < Vec < TraitCandidate > > >
2004
+ {
2005
+ tcx. gcx . trait_map . get ( & id) . cloned ( )
2006
+ }
2007
+
2008
+ fn module_exports < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , id : HirId )
2009
+ -> Option < Rc < Vec < Export > > >
2010
+ {
2011
+ tcx. gcx . export_map . get ( & id) . cloned ( )
2012
+ }
2013
+
2014
+ pub fn provide ( providers : & mut ty:: maps:: Providers ) {
2015
+ providers. in_scope_traits = in_scope_traits;
2016
+ providers. module_exports = module_exports;
2017
+ }
0 commit comments