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