1
Fork 0

rustc_metadata: Rename item_children(_untracked) to module_children(_untracked)

And `each_child_of_item` to `for_each_module_child`
This commit is contained in:
Vadim Petrochenkov 2021-12-23 16:12:34 +08:00
parent 96c6a50e96
commit 3051f6e9c4
14 changed files with 27 additions and 22 deletions

View file

@ -1079,7 +1079,12 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
/// including both proper items and reexports.
/// Module here is understood in name resolution sense - it can be a `mod` item,
/// or a crate root, or an enum, or a trait.
fn each_child_of_item(&self, id: DefIndex, mut callback: impl FnMut(Export), sess: &Session) {
fn for_each_module_child(
&self,
id: DefIndex,
mut callback: impl FnMut(Export),
sess: &Session,
) {
if let Some(data) = &self.root.proc_macro_data {
// If we are loading as a proc macro, we want to return
// the view of this crate as a proc macro crate.
@ -1164,7 +1169,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}
}
EntryKind::Enum(..) | EntryKind::Trait(..) => {}
_ => bug!("`each_child_of_item` is called on a non-module: {:?}", self.def_kind(id)),
_ => bug!("`for_each_module_child` is called on a non-module: {:?}", self.def_kind(id)),
}
}

View file

@ -196,9 +196,9 @@ provide! { <'tcx> tcx, def_id, other, cdata,
let r = *cdata.dep_kind.lock();
r
}
item_children => {
module_children => {
let mut result = SmallVec::<[_; 8]>::new();
cdata.each_child_of_item(def_id.index, |child| result.push(child), tcx.sess);
cdata.for_each_module_child(def_id.index, |child| result.push(child), tcx.sess);
tcx.arena.alloc_slice(&result)
}
defined_lib_features => { cdata.get_lib_features(tcx) }
@ -342,7 +342,7 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
};
while let Some(def) = bfs_queue.pop_front() {
for child in tcx.item_children(def).iter() {
for child in tcx.module_children(def).iter() {
add_child(bfs_queue, child, def);
}
}
@ -388,9 +388,9 @@ impl CStore {
self.get_crate_data(def.krate).get_visibility(def.index)
}
pub fn item_children_untracked(&self, def_id: DefId, sess: &Session) -> Vec<Export> {
pub fn module_children_untracked(&self, def_id: DefId, sess: &Session) -> Vec<Export> {
let mut result = vec![];
self.get_crate_data(def_id.krate).each_child_of_item(
self.get_crate_data(def_id.krate).for_each_module_child(
def_id.index,
|child| result.push(child),
sess,