rustc_middle: Rename Export
to ModChild
and add some comments
Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.
This commit is contained in:
parent
3051f6e9c4
commit
4b03fd910c
17 changed files with 66 additions and 64 deletions
|
@ -26,7 +26,7 @@ use rustc_hir::def::{self, *};
|
|||
use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_INDEX};
|
||||
use rustc_metadata::creader::LoadedMacro;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::hir::exports::Export;
|
||||
use rustc_middle::metadata::ModChild;
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::cstore::CrateStore;
|
||||
use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind};
|
||||
|
@ -938,9 +938,9 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
}
|
||||
|
||||
/// Builds the reduced graph for a single item in an external crate.
|
||||
fn build_reduced_graph_for_external_crate_res(&mut self, child: Export) {
|
||||
fn build_reduced_graph_for_external_crate_res(&mut self, child: ModChild) {
|
||||
let parent = self.parent_scope.module;
|
||||
let Export { ident, res, vis, span } = child;
|
||||
let ModChild { ident, res, vis, span } = child;
|
||||
let res = res.expect_non_local();
|
||||
let expansion = self.parent_scope.expansion;
|
||||
// Record primary definitions.
|
||||
|
|
|
@ -15,7 +15,7 @@ use rustc_data_structures::ptr_key::PtrKey;
|
|||
use rustc_errors::{pluralize, struct_span_err, Applicability};
|
||||
use rustc_hir::def::{self, PartialRes};
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_middle::hir::exports::Export;
|
||||
use rustc_middle::metadata::ModChild;
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::lint::builtin::{PUB_USE_OF_PRIVATE_EXTERN_CRATE, UNUSED_IMPORTS};
|
||||
|
@ -1409,7 +1409,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
if is_good_import || binding.is_macro_def() {
|
||||
let res = binding.res().expect_non_local();
|
||||
if res != def::Res::Err {
|
||||
reexports.push(Export { ident, res, span: binding.span, vis: binding.vis });
|
||||
reexports.push(ModChild { ident, res, vis: binding.vis, span: binding.span });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1418,7 +1418,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
|
|||
if let Some(def_id) = module.opt_def_id() {
|
||||
// Call to `expect_local` should be fine because current
|
||||
// code is only called for local modules.
|
||||
self.r.export_map.insert(def_id.expect_local(), reexports);
|
||||
self.r.reexport_map.insert(def_id.expect_local(), reexports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ use rustc_hir::definitions::{DefKey, DefPathData, Definitions};
|
|||
use rustc_hir::TraitCandidate;
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_metadata::creader::{CStore, CrateLoader};
|
||||
use rustc_middle::hir::exports::ExportMap;
|
||||
use rustc_middle::metadata::ModChild;
|
||||
use rustc_middle::span_bug;
|
||||
use rustc_middle::ty::query::Providers;
|
||||
use rustc_middle::ty::{self, DefIdTree, MainDefinition, ResolverOutputs};
|
||||
|
@ -927,7 +927,7 @@ pub struct Resolver<'a> {
|
|||
|
||||
/// `CrateNum` resolutions of `extern crate` items.
|
||||
extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
|
||||
export_map: ExportMap,
|
||||
reexport_map: FxHashMap<LocalDefId, Vec<ModChild>>,
|
||||
trait_map: NodeMap<Vec<TraitCandidate>>,
|
||||
|
||||
/// A map from nodes to anonymous modules.
|
||||
|
@ -1333,7 +1333,7 @@ impl<'a> Resolver<'a> {
|
|||
import_res_map: Default::default(),
|
||||
label_res_map: Default::default(),
|
||||
extern_crate_map: Default::default(),
|
||||
export_map: FxHashMap::default(),
|
||||
reexport_map: FxHashMap::default(),
|
||||
trait_map: NodeMap::default(),
|
||||
underscore_disambiguator: 0,
|
||||
empty_module,
|
||||
|
@ -1446,7 +1446,7 @@ impl<'a> Resolver<'a> {
|
|||
let definitions = self.definitions;
|
||||
let visibilities = self.visibilities;
|
||||
let extern_crate_map = self.extern_crate_map;
|
||||
let export_map = self.export_map;
|
||||
let reexport_map = self.reexport_map;
|
||||
let maybe_unused_trait_imports = self.maybe_unused_trait_imports;
|
||||
let maybe_unused_extern_crates = self.maybe_unused_extern_crates;
|
||||
let glob_map = self.glob_map;
|
||||
|
@ -1457,7 +1457,7 @@ impl<'a> Resolver<'a> {
|
|||
cstore: Box::new(self.crate_loader.into_cstore()),
|
||||
visibilities,
|
||||
extern_crate_map,
|
||||
export_map,
|
||||
reexport_map,
|
||||
glob_map,
|
||||
maybe_unused_trait_imports,
|
||||
maybe_unused_extern_crates,
|
||||
|
@ -1480,7 +1480,7 @@ impl<'a> Resolver<'a> {
|
|||
cstore: Box::new(self.cstore().clone()),
|
||||
visibilities: self.visibilities.clone(),
|
||||
extern_crate_map: self.extern_crate_map.clone(),
|
||||
export_map: self.export_map.clone(),
|
||||
reexport_map: self.reexport_map.clone(),
|
||||
glob_map: self.glob_map.clone(),
|
||||
maybe_unused_trait_imports: self.maybe_unused_trait_imports.clone(),
|
||||
maybe_unused_extern_crates: self.maybe_unused_extern_crates.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue