move export_map into the tcx

This commit is contained in:
Niko Matsakis 2017-03-23 14:18:25 -04:00
parent d5580374d7
commit a3a5ff98eb
11 changed files with 26 additions and 46 deletions

View file

@ -13,7 +13,7 @@ use rustc_driver::{driver, target_features, abort_on_err};
use rustc::dep_graph::DepGraph;
use rustc::session::{self, config};
use rustc::hir::def_id::DefId;
use rustc::hir::def::{Def, ExportMap};
use rustc::hir::def::Def;
use rustc::middle::privacy::AccessLevels;
use rustc::ty::{self, TyCtxt, GlobalArenas};
use rustc::hir::map as hir_map;
@ -64,7 +64,6 @@ pub struct DocContext<'a, 'tcx: 'a> {
pub ty_substs: RefCell<FxHashMap<Def, clean::Type>>,
/// Table node id of lifetime parameter definition -> substituted lifetime
pub lt_substs: RefCell<FxHashMap<ast::NodeId, clean::Lifetime>>,
pub export_map: ExportMap,
}
impl<'a, 'tcx> DocContext<'a, 'tcx> {
@ -180,7 +179,7 @@ pub fn run_core(search_paths: SearchPaths,
sess.fatal("Compilation failed, aborting rustdoc");
}
let ty::CrateAnalysis { access_levels, export_map, .. } = analysis;
let ty::CrateAnalysis { access_levels, .. } = analysis;
// Convert from a NodeId set to a DefId set since we don't always have easy access
// to the map from defid -> nodeid
@ -198,7 +197,6 @@ pub fn run_core(search_paths: SearchPaths,
renderinfo: Default::default(),
ty_substs: Default::default(),
lt_substs: Default::default(),
export_map: export_map,
};
debug!("crate: {:?}", tcx.hir.krate());

View file

@ -198,7 +198,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
self.visit_item(item, None, &mut om);
}
self.inside_public_path = orig_inside_public_path;
if let Some(exports) = self.cx.export_map.get(&id) {
if let Some(exports) = self.cx.tcx.export_map.get(&id) {
for export in exports {
if let Def::Macro(def_id, ..) = export.def {
if def_id.krate == LOCAL_CRATE {