@@ -531,44 +531,21 @@ impl<'tcx> EmbargoVisitor<'tcx> {
531
531
macro_ev : EffectiveVisibility ,
532
532
) -> bool {
533
533
if self . macro_reachable . insert ( ( module_def_id, defining_mod) ) {
534
- self . update_macro_reachable_mod ( module_def_id, defining_mod, macro_ev) ;
534
+ for child in self . tcx . module_children_local ( module_def_id. to_local_def_id ( ) ) {
535
+ if let Res :: Def ( def_kind, def_id) = child. res
536
+ && let Some ( def_id) = def_id. as_local ( )
537
+ && child. vis . is_accessible_from ( defining_mod, self . tcx )
538
+ {
539
+ let vis = self . tcx . local_visibility ( def_id) ;
540
+ self . update_macro_reachable_def ( def_id, def_kind, vis, defining_mod, macro_ev) ;
541
+ }
542
+ }
535
543
true
536
544
} else {
537
545
false
538
546
}
539
547
}
540
548
541
- fn update_macro_reachable_mod (
542
- & mut self ,
543
- module_def_id : LocalModDefId ,
544
- defining_mod : LocalModDefId ,
545
- macro_ev : EffectiveVisibility ,
546
- ) {
547
- let module = self . tcx . hir ( ) . get_module ( module_def_id) . 0 ;
548
- for item_id in module. item_ids {
549
- let def_kind = self . tcx . def_kind ( item_id. owner_id ) ;
550
- let vis = self . tcx . local_visibility ( item_id. owner_id . def_id ) ;
551
- self . update_macro_reachable_def (
552
- item_id. owner_id . def_id ,
553
- def_kind,
554
- vis,
555
- defining_mod,
556
- macro_ev,
557
- ) ;
558
- }
559
- for child in self . tcx . module_children_local ( module_def_id. to_local_def_id ( ) ) {
560
- // FIXME: Use module children for the logic above too.
561
- if !child. reexport_chain . is_empty ( )
562
- && child. vis . is_accessible_from ( defining_mod, self . tcx )
563
- && let Res :: Def ( def_kind, def_id) = child. res
564
- && let Some ( def_id) = def_id. as_local ( )
565
- {
566
- let vis = self . tcx . local_visibility ( def_id) ;
567
- self . update_macro_reachable_def ( def_id, def_kind, vis, defining_mod, macro_ev) ;
568
- }
569
- }
570
- }
571
-
572
549
fn update_macro_reachable_def (
573
550
& mut self ,
574
551
def_id : LocalDefId ,
0 commit comments