use rustc_ast as ast;
use rustc_data_structures::stable_map::FxHashMap;
-use rustc_hir as hir;
use rustc_hir::def::{CtorKind, DefKind};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX, LOCAL_CRATE};
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
// (restrict scope of mutable-borrow of `visible_parent_map`)
{
let visible_parent_map = &mut visible_parent_map;
- let mut add_child =
- |bfs_queue: &mut VecDeque<_>, child: &Export<hir::HirId>, parent: DefId| {
- if child.vis != ty::Visibility::Public {
- return;
- }
+ let mut add_child = |bfs_queue: &mut VecDeque<_>, child: &Export, parent: DefId| {
+ if child.vis != ty::Visibility::Public {
+ return;
+ }
- if let Some(child) = child.res.opt_def_id() {
- match visible_parent_map.entry(child) {
- Entry::Occupied(mut entry) => {
- // If `child` is defined in crate `cnum`, ensure
- // that it is mapped to a parent in `cnum`.
- if child.is_local() && entry.get().is_local() {
- entry.insert(parent);
- }
- }
- Entry::Vacant(entry) => {
+ if let Some(child) = child.res.opt_def_id() {
+ match visible_parent_map.entry(child) {
+ Entry::Occupied(mut entry) => {
+ // If `child` is defined in crate `cnum`, ensure
+ // that it is mapped to a parent in `cnum`.
+ if child.is_local() && entry.get().is_local() {
entry.insert(parent);
- bfs_queue.push_back(child);
}
}
+ Entry::Vacant(entry) => {
+ entry.insert(parent);
+ bfs_queue.push_back(child);
+ }
}
- };
+ }
+ };
while let Some(def) = bfs_queue.pop_front() {
for child in tcx.item_children(def).iter() {
self.get_crate_data(def.krate).get_visibility(def.index)
}
- pub fn item_children_untracked(
- &self,
- def_id: DefId,
- sess: &Session,
- ) -> Vec<Export<hir::HirId>> {
+ pub fn item_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(
def_id.index,