@@ -5,7 +5,6 @@ use crate::rmeta::encoder;
55
66use rustc_ast as ast;
77use rustc_data_structures:: stable_map:: FxHashMap ;
8- use rustc_hir as hir;
98use rustc_hir:: def:: { CtorKind , DefKind } ;
109use rustc_hir:: def_id:: { CrateNum , DefId , DefIdMap , CRATE_DEF_INDEX , LOCAL_CRATE } ;
1110use rustc_hir:: definitions:: { DefKey , DefPath , DefPathHash } ;
@@ -326,28 +325,27 @@ pub fn provide(providers: &mut Providers) {
326325 // (restrict scope of mutable-borrow of `visible_parent_map`)
327326 {
328327 let visible_parent_map = & mut visible_parent_map;
329- let mut add_child =
330- |bfs_queue : & mut VecDeque < _ > , child : & Export < hir:: HirId > , parent : DefId | {
331- if child. vis != ty:: Visibility :: Public {
332- return ;
333- }
328+ let mut add_child = |bfs_queue : & mut VecDeque < _ > , child : & Export , parent : DefId | {
329+ if child. vis != ty:: Visibility :: Public {
330+ return ;
331+ }
334332
335- if let Some ( child) = child. res . opt_def_id ( ) {
336- match visible_parent_map. entry ( child) {
337- Entry :: Occupied ( mut entry) => {
338- // If `child` is defined in crate `cnum`, ensure
339- // that it is mapped to a parent in `cnum`.
340- if child. is_local ( ) && entry. get ( ) . is_local ( ) {
341- entry. insert ( parent) ;
342- }
343- }
344- Entry :: Vacant ( entry) => {
333+ if let Some ( child) = child. res . opt_def_id ( ) {
334+ match visible_parent_map. entry ( child) {
335+ Entry :: Occupied ( mut entry) => {
336+ // If `child` is defined in crate `cnum`, ensure
337+ // that it is mapped to a parent in `cnum`.
338+ if child. is_local ( ) && entry. get ( ) . is_local ( ) {
345339 entry. insert ( parent) ;
346- bfs_queue. push_back ( child) ;
347340 }
348341 }
342+ Entry :: Vacant ( entry) => {
343+ entry. insert ( parent) ;
344+ bfs_queue. push_back ( child) ;
345+ }
349346 }
350- } ;
347+ }
348+ } ;
351349
352350 while let Some ( def) = bfs_queue. pop_front ( ) {
353351 for child in tcx. item_children ( def) . iter ( ) {
@@ -393,11 +391,7 @@ impl CStore {
393391 self . get_crate_data ( def. krate ) . get_visibility ( def. index )
394392 }
395393
396- pub fn item_children_untracked (
397- & self ,
398- def_id : DefId ,
399- sess : & Session ,
400- ) -> Vec < Export < hir:: HirId > > {
394+ pub fn item_children_untracked ( & self , def_id : DefId , sess : & Session ) -> Vec < Export > {
401395 let mut result = vec ! [ ] ;
402396 self . get_crate_data ( def_id. krate ) . each_child_of_item (
403397 def_id. index ,
0 commit comments