@@ -831,12 +831,12 @@ pub struct Resolver<'a> {
831
831
session : & ' a Session ,
832
832
cstore : & ' a CStore ,
833
833
834
- pub definitions : Definitions ,
834
+ definitions : Definitions ,
835
835
836
- pub graph_root : Module < ' a > ,
836
+ graph_root : Module < ' a > ,
837
837
838
838
prelude : Option < Module < ' a > > ,
839
- pub extern_prelude : FxHashMap < Ident , ExternPreludeEntry < ' a > > ,
839
+ extern_prelude : FxHashMap < Ident , ExternPreludeEntry < ' a > > ,
840
840
841
841
/// N.B., this is used only for better diagnostics, not name resolution itself.
842
842
has_self : FxHashSet < DefId > ,
@@ -869,9 +869,9 @@ pub struct Resolver<'a> {
869
869
label_res_map : NodeMap < NodeId > ,
870
870
871
871
/// `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 ,
875
875
876
876
/// A map from nodes to anonymous modules.
877
877
/// Anonymous modules are pseudo-modules that are implicitly created around items
@@ -898,11 +898,11 @@ pub struct Resolver<'a> {
898
898
underscore_disambiguator : u32 ,
899
899
900
900
/// Maps glob imports to the names of items actually imported.
901
- pub glob_map : GlobMap ,
901
+ glob_map : GlobMap ,
902
902
903
903
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 ) > ,
906
906
907
907
/// Privacy errors are delayed until the end in order to deduplicate them.
908
908
privacy_errors : Vec < PrivacyError < ' a > > ,
@@ -920,7 +920,7 @@ pub struct Resolver<'a> {
920
920
macro_names : FxHashSet < Ident > ,
921
921
builtin_macros : FxHashMap < Name , SyntaxExtension > ,
922
922
macro_use_prelude : FxHashMap < Name , & ' a NameBinding < ' a > > ,
923
- pub all_macros : FxHashMap < Name , Res > ,
923
+ all_macros : FxHashMap < Name , Res > ,
924
924
macro_map : FxHashMap < DefId , Lrc < SyntaxExtension > > ,
925
925
dummy_ext_bang : Lrc < SyntaxExtension > ,
926
926
dummy_ext_derive : Lrc < SyntaxExtension > ,
@@ -1236,6 +1236,40 @@ impl<'a> Resolver<'a> {
1236
1236
Default :: default ( )
1237
1237
}
1238
1238
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
+
1239
1273
fn non_macro_attr ( & self , mark_used : bool ) -> Lrc < SyntaxExtension > {
1240
1274
self . non_macro_attrs [ mark_used as usize ] . clone ( )
1241
1275
}
@@ -2808,6 +2842,16 @@ impl<'a> Resolver<'a> {
2808
2842
seg. id = self . session . next_node_id ( ) ;
2809
2843
seg
2810
2844
}
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
+ }
2811
2855
}
2812
2856
2813
2857
fn names_to_string ( names : & [ Name ] ) -> String {
0 commit comments