@@ -1544,20 +1544,17 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
1544
1544
ret
1545
1545
}
1546
1546
1547
- fn with_scope < T > ( & mut self , id : NodeId , f : impl FnOnce ( & mut Self ) -> T ) -> T {
1548
- if let Some ( module) = self . r . get_module ( self . r . local_def_id ( id) . to_def_id ( ) ) {
1549
- // Move down in the graph.
1550
- let orig_module = replace ( & mut self . parent_scope . module , module) ;
1551
- self . with_rib ( ValueNS , RibKind :: Module ( module) , |this| {
1552
- this. with_rib ( TypeNS , RibKind :: Module ( module) , |this| {
1553
- let ret = f ( this) ;
1554
- this. parent_scope . module = orig_module;
1555
- ret
1556
- } )
1547
+ fn with_mod_rib < T > ( & mut self , id : NodeId , f : impl FnOnce ( & mut Self ) -> T ) -> T {
1548
+ let module = self . r . expect_module ( self . r . local_def_id ( id) . to_def_id ( ) ) ;
1549
+ // Move down in the graph.
1550
+ let orig_module = replace ( & mut self . parent_scope . module , module) ;
1551
+ self . with_rib ( ValueNS , RibKind :: Module ( module) , |this| {
1552
+ this. with_rib ( TypeNS , RibKind :: Module ( module) , |this| {
1553
+ let ret = f ( this) ;
1554
+ this. parent_scope . module = orig_module;
1555
+ ret
1557
1556
} )
1558
- } else {
1559
- f ( self )
1560
- }
1557
+ } )
1561
1558
}
1562
1559
1563
1560
fn visit_generic_params ( & mut self , params : & ' ast [ GenericParam ] , add_self_upper : bool ) {
@@ -2738,7 +2735,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
2738
2735
}
2739
2736
2740
2737
ItemKind :: Mod ( ..) => {
2741
- self . with_scope ( item. id , |this| {
2738
+ self . with_mod_rib ( item. id , |this| {
2742
2739
if mod_inner_docs {
2743
2740
this. resolve_doc_links ( & item. attrs , MaybeExported :: Ok ( item. id ) ) ;
2744
2741
}
0 commit comments