File tree 1 file changed +7
-13
lines changed
1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -941,27 +941,21 @@ impl Visitor<'tcx> for EmbargoVisitor<'tcx> {
941
941
return ;
942
942
}
943
943
944
- let macro_module_def_id =
945
- ty:: DefIdTree :: parent ( self . tcx , self . tcx . hir ( ) . local_def_id ( md. hir_id ) . to_def_id ( ) )
946
- . unwrap ( ) ;
947
- // FIXME(#71104) Should really be using just `as_local_hir_id` but
948
- // some `DefId` do not seem to have a corresponding HirId.
949
- let hir_id = macro_module_def_id
950
- . as_local ( )
951
- . and_then ( |def_id| self . tcx . hir ( ) . opt_local_def_id_to_hir_id ( def_id) ) ;
952
- let mut module_id = match hir_id {
953
- Some ( module_id) if self . tcx . hir ( ) . is_hir_id_module ( module_id) => module_id,
944
+ let macro_module_def_id = self . tcx . hir ( ) . get_parent_did ( md. hir_id ) ;
945
+ let mut module_id = self . tcx . hir ( ) . as_local_hir_id ( macro_module_def_id) ;
946
+ if !self . tcx . hir ( ) . is_hir_id_module ( module_id) {
954
947
// `module_id` doesn't correspond to a `mod`, return early (#63164, #65252).
955
- _ => return ,
956
- } ;
948
+ return ;
949
+ }
957
950
let level = if md. vis . node . is_pub ( ) { self . get ( module_id) } else { None } ;
958
951
let new_level = self . update ( md. hir_id , level) ;
959
952
if new_level. is_none ( ) {
960
953
return ;
961
954
}
962
955
963
956
loop {
964
- let changed_reachability = self . update_macro_reachable ( module_id, macro_module_def_id) ;
957
+ let changed_reachability =
958
+ self . update_macro_reachable ( module_id, macro_module_def_id. to_def_id ( ) ) ;
965
959
if changed_reachability || module_id == hir:: CRATE_HIR_ID {
966
960
break ;
967
961
}
You can’t perform that action at this time.
0 commit comments