@@ -1528,19 +1528,6 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1528
1528
ret
1529
1529
}
1530
1530
1531
- fn with_mod_rib < T > ( & mut self , id : NodeId , f : impl FnOnce ( & mut Self ) -> T ) -> T {
1532
- let module = self . r . expect_module ( self . r . local_def_id ( id) . to_def_id ( ) ) ;
1533
- // Move down in the graph.
1534
- let orig_module = replace ( & mut self . parent_scope . module , module) ;
1535
- self . with_rib ( ValueNS , RibKind :: Module ( module) , |this| {
1536
- this. with_rib ( TypeNS , RibKind :: Module ( module) , |this| {
1537
- let ret = f ( this) ;
1538
- this. parent_scope . module = orig_module;
1539
- ret
1540
- } )
1541
- } )
1542
- }
1543
-
1544
1531
fn visit_generic_params ( & mut self , params : & ' ast [ GenericParam ] , add_self_upper : bool ) {
1545
1532
// For type parameter defaults, we have to ban access
1546
1533
// to following type parameters, as the GenericArgs can only
@@ -2678,20 +2665,25 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2678
2665
}
2679
2666
2680
2667
ItemKind :: Mod ( ..) => {
2681
- self . with_mod_rib ( item. id , |this| {
2682
- if mod_inner_docs {
2683
- this. resolve_doc_links ( & item. attrs , MaybeExported :: Ok ( item. id ) ) ;
2684
- }
2685
- let old_macro_rules = this. parent_scope . macro_rules ;
2686
- visit:: walk_item ( this, item) ;
2687
- // Maintain macro_rules scopes in the same way as during early resolution
2688
- // for diagnostics and doc links.
2689
- if item. attrs . iter ( ) . all ( |attr| {
2690
- !attr. has_name ( sym:: macro_use) && !attr. has_name ( sym:: macro_escape)
2691
- } ) {
2692
- this. parent_scope . macro_rules = old_macro_rules;
2693
- }
2668
+ let module = self . r . expect_module ( self . r . local_def_id ( item. id ) . to_def_id ( ) ) ;
2669
+ let orig_module = replace ( & mut self . parent_scope . module , module) ;
2670
+ self . with_rib ( ValueNS , RibKind :: Module ( module) , |this| {
2671
+ this. with_rib ( TypeNS , RibKind :: Module ( module) , |this| {
2672
+ if mod_inner_docs {
2673
+ this. resolve_doc_links ( & item. attrs , MaybeExported :: Ok ( item. id ) ) ;
2674
+ }
2675
+ let old_macro_rules = this. parent_scope . macro_rules ;
2676
+ visit:: walk_item ( this, item) ;
2677
+ // Maintain macro_rules scopes in the same way as during early resolution
2678
+ // for diagnostics and doc links.
2679
+ if item. attrs . iter ( ) . all ( |attr| {
2680
+ !attr. has_name ( sym:: macro_use) && !attr. has_name ( sym:: macro_escape)
2681
+ } ) {
2682
+ this. parent_scope . macro_rules = old_macro_rules;
2683
+ }
2684
+ } )
2694
2685
} ) ;
2686
+ self . parent_scope . module = orig_module;
2695
2687
}
2696
2688
2697
2689
ItemKind :: Static ( box ast:: StaticItem {
0 commit comments