@@ -831,12 +831,12 @@ pub struct Resolver<'a> {
831831 session : & ' a Session ,
832832 cstore : & ' a CStore ,
833833
834- pub definitions : Definitions ,
834+ definitions : Definitions ,
835835
836- pub graph_root : Module < ' a > ,
836+ graph_root : Module < ' a > ,
837837
838838 prelude : Option < Module < ' a > > ,
839- pub extern_prelude : FxHashMap < Ident , ExternPreludeEntry < ' a > > ,
839+ extern_prelude : FxHashMap < Ident , ExternPreludeEntry < ' a > > ,
840840
841841 /// N.B., this is used only for better diagnostics, not name resolution itself.
842842 has_self : FxHashSet < DefId > ,
@@ -869,9 +869,9 @@ pub struct Resolver<'a> {
869869 label_res_map : NodeMap < NodeId > ,
870870
871871 /// `CrateNum` resolutions of `extern crate` items.
872- pub extern_crate_map : NodeMap < CrateNum > ,
873- pub export_map : ExportMap < NodeId > ,
874- pub trait_map : TraitMap ,
872+ extern_crate_map : NodeMap < CrateNum > ,
873+ export_map : ExportMap < NodeId > ,
874+ trait_map : TraitMap ,
875875
876876 /// A map from nodes to anonymous modules.
877877 /// Anonymous modules are pseudo-modules that are implicitly created around items
@@ -898,11 +898,11 @@ pub struct Resolver<'a> {
898898 underscore_disambiguator : u32 ,
899899
900900 /// Maps glob imports to the names of items actually imported.
901- pub glob_map : GlobMap ,
901+ glob_map : GlobMap ,
902902
903903 used_imports : FxHashSet < ( NodeId , Namespace ) > ,
904- pub maybe_unused_trait_imports : NodeSet ,
905- pub maybe_unused_extern_crates : Vec < ( NodeId , Span ) > ,
904+ maybe_unused_trait_imports : NodeSet ,
905+ maybe_unused_extern_crates : Vec < ( NodeId , Span ) > ,
906906
907907 /// Privacy errors are delayed until the end in order to deduplicate them.
908908 privacy_errors : Vec < PrivacyError < ' a > > ,
@@ -920,7 +920,7 @@ pub struct Resolver<'a> {
920920 macro_names : FxHashSet < Ident > ,
921921 builtin_macros : FxHashMap < Name , SyntaxExtension > ,
922922 macro_use_prelude : FxHashMap < Name , & ' a NameBinding < ' a > > ,
923- pub all_macros : FxHashMap < Name , Res > ,
923+ all_macros : FxHashMap < Name , Res > ,
924924 macro_map : FxHashMap < DefId , Lrc < SyntaxExtension > > ,
925925 dummy_ext_bang : Lrc < SyntaxExtension > ,
926926 dummy_ext_derive : Lrc < SyntaxExtension > ,
@@ -1236,6 +1236,40 @@ impl<'a> Resolver<'a> {
12361236 Default :: default ( )
12371237 }
12381238
1239+ pub fn into_outputs ( self ) -> ( Definitions , ty:: Resolutions ) {
1240+ (
1241+ self . definitions ,
1242+ ty:: Resolutions {
1243+ extern_crate_map : self . extern_crate_map ,
1244+ export_map : self . export_map ,
1245+ trait_map : self . trait_map ,
1246+ glob_map : self . glob_map ,
1247+ maybe_unused_trait_imports : self . maybe_unused_trait_imports ,
1248+ maybe_unused_extern_crates : self . maybe_unused_extern_crates ,
1249+ extern_prelude : self . extern_prelude . iter ( ) . map ( |( ident, entry) | {
1250+ ( ident. name , entry. introduced_by_item )
1251+ } ) . collect ( ) ,
1252+ } ,
1253+ )
1254+ }
1255+
1256+ pub fn clone_outputs ( & self ) -> ( Definitions , ty:: Resolutions ) {
1257+ (
1258+ self . definitions . clone ( ) ,
1259+ ty:: Resolutions {
1260+ extern_crate_map : self . extern_crate_map . clone ( ) ,
1261+ export_map : self . export_map . clone ( ) ,
1262+ trait_map : self . trait_map . clone ( ) ,
1263+ glob_map : self . glob_map . clone ( ) ,
1264+ maybe_unused_trait_imports : self . maybe_unused_trait_imports . clone ( ) ,
1265+ maybe_unused_extern_crates : self . maybe_unused_extern_crates . clone ( ) ,
1266+ extern_prelude : self . extern_prelude . iter ( ) . map ( |( ident, entry) | {
1267+ ( ident. name , entry. introduced_by_item )
1268+ } ) . collect ( ) ,
1269+ } ,
1270+ )
1271+ }
1272+
12391273 fn non_macro_attr ( & self , mark_used : bool ) -> Lrc < SyntaxExtension > {
12401274 self . non_macro_attrs [ mark_used as usize ] . clone ( )
12411275 }
@@ -2808,6 +2842,16 @@ impl<'a> Resolver<'a> {
28082842 seg. id = self . session . next_node_id ( ) ;
28092843 seg
28102844 }
2845+
2846+ // For rustdoc.
2847+ pub fn graph_root ( & self ) -> Module < ' a > {
2848+ self . graph_root
2849+ }
2850+
2851+ // For rustdoc.
2852+ pub fn all_macros ( & self ) -> & FxHashMap < Name , Res > {
2853+ & self . all_macros
2854+ }
28112855}
28122856
28132857fn names_to_string ( names : & [ Name ] ) -> String {
0 commit comments