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
|
@ -21,7 +21,7 @@ use rustc_hir::definitions::{DefKey, DefPath, DefPathData, DefPathHash};
|
|||
use rustc_hir::diagnostic_items::DiagnosticItems;
|
||||
use rustc_hir::lang_items;
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_middle::hir::exports::Export;
|
||||
use rustc_middle::metadata::ModChild;
|
||||
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
|
||||
use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
|
||||
use rustc_middle::mir::{self, Body, Promoted};
|
||||
|
@ -1082,7 +1082,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
fn for_each_module_child(
|
||||
&self,
|
||||
id: DefIndex,
|
||||
mut callback: impl FnMut(Export),
|
||||
mut callback: impl FnMut(ModChild),
|
||||
sess: &Session,
|
||||
) {
|
||||
if let Some(data) = &self.root.proc_macro_data {
|
||||
|
@ -1096,7 +1096,12 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
self.local_def_id(def_index),
|
||||
);
|
||||
let ident = self.item_ident(def_index, sess);
|
||||
callback(Export { ident, res, vis: ty::Visibility::Public, span: ident.span });
|
||||
callback(ModChild {
|
||||
ident,
|
||||
res,
|
||||
vis: ty::Visibility::Public,
|
||||
span: ident.span,
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -1117,7 +1122,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
let vis = self.get_visibility(child_index);
|
||||
let span = self.get_span(child_index, sess);
|
||||
|
||||
callback(Export { ident, res, vis, span });
|
||||
callback(ModChild { ident, res, vis, span });
|
||||
|
||||
// For non-re-export structs and variants add their constructors to children.
|
||||
// Re-export lists automatically contain constructors when necessary.
|
||||
|
@ -1129,7 +1134,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
let ctor_res =
|
||||
Res::Def(DefKind::Ctor(CtorOf::Struct, ctor_kind), ctor_def_id);
|
||||
let vis = self.get_visibility(ctor_def_id.index);
|
||||
callback(Export { res: ctor_res, vis, ident, span });
|
||||
callback(ModChild { ident, res: ctor_res, vis, span });
|
||||
}
|
||||
}
|
||||
DefKind::Variant => {
|
||||
|
@ -1154,7 +1159,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
vis = ty::Visibility::Restricted(crate_def_id);
|
||||
}
|
||||
}
|
||||
callback(Export { res: ctor_res, ident, vis, span });
|
||||
callback(ModChild { ident, res: ctor_res, vis, span });
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ use rustc_data_structures::stable_map::FxHashMap;
|
|||
use rustc_hir::def::{CtorKind, DefKind, Res};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
|
||||
use rustc_middle::hir::exports::Export;
|
||||
use rustc_middle::metadata::ModChild;
|
||||
use rustc_middle::middle::exported_symbols::ExportedSymbol;
|
||||
use rustc_middle::middle::stability::DeprecationEntry;
|
||||
use rustc_middle::ty::query::{ExternProviders, Providers};
|
||||
|
@ -309,7 +309,7 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
|
|||
bfs_queue.push_back(DefId { krate: cnum, index: CRATE_DEF_INDEX });
|
||||
}
|
||||
|
||||
let mut add_child = |bfs_queue: &mut VecDeque<_>, child: &Export, parent: DefId| {
|
||||
let mut add_child = |bfs_queue: &mut VecDeque<_>, child: &ModChild, parent: DefId| {
|
||||
if !child.vis.is_public() {
|
||||
return;
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ impl CStore {
|
|||
self.get_crate_data(def.krate).get_visibility(def.index)
|
||||
}
|
||||
|
||||
pub fn module_children_untracked(&self, def_id: DefId, sess: &Session) -> Vec<Export> {
|
||||
pub fn module_children_untracked(&self, def_id: DefId, sess: &Session) -> Vec<ModChild> {
|
||||
let mut result = vec![];
|
||||
self.get_crate_data(def_id.krate).for_each_module_child(
|
||||
def_id.index,
|
||||
|
|
|
@ -1094,7 +1094,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
|||
// code uses it). However, we skip encoding anything relating to child
|
||||
// items - we encode information about proc-macros later on.
|
||||
let reexports = if !self.is_proc_macro {
|
||||
match tcx.module_exports(local_def_id) {
|
||||
match tcx.module_reexports(local_def_id) {
|
||||
Some(exports) => self.lazy(exports),
|
||||
_ => Lazy::empty(),
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use rustc_hir::def_id::{DefId, DefIndex, DefPathHash, StableCrateId};
|
|||
use rustc_hir::definitions::DefKey;
|
||||
use rustc_hir::lang_items;
|
||||
use rustc_index::{bit_set::FiniteBitSet, vec::IndexVec};
|
||||
use rustc_middle::hir::exports::Export;
|
||||
use rustc_middle::metadata::ModChild;
|
||||
use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel};
|
||||
use rustc_middle::mir;
|
||||
use rustc_middle::thir;
|
||||
|
@ -350,7 +350,7 @@ enum EntryKind {
|
|||
Union(Lazy<VariantData>, ReprOptions),
|
||||
Fn(Lazy<FnData>),
|
||||
ForeignFn(Lazy<FnData>),
|
||||
Mod(Lazy<[Export]>),
|
||||
Mod(Lazy<[ModChild]>),
|
||||
MacroDef(Lazy<MacroDef>),
|
||||
ProcMacro(MacroKind),
|
||||
Closure,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue