@@ -1229,49 +1229,6 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1229
1229
}
1230
1230
}
1231
1231
1232
- fn resolve_block ( & mut self , block : & Block ) {
1233
- debug ! ( "(resolving block) entering block" ) ;
1234
- // Move down in the graph, if there's an anonymous module rooted here.
1235
- let orig_module = self . parent_scope . module ;
1236
- let anonymous_module = self . r . block_map . get ( & block. id ) . cloned ( ) ; // clones a reference
1237
-
1238
- let mut num_macro_definition_ribs = 0 ;
1239
- if let Some ( anonymous_module) = anonymous_module {
1240
- debug ! ( "(resolving block) found anonymous module, moving down" ) ;
1241
- self . ribs [ ValueNS ] . push ( Rib :: new ( ModuleRibKind ( anonymous_module) ) ) ;
1242
- self . ribs [ TypeNS ] . push ( Rib :: new ( ModuleRibKind ( anonymous_module) ) ) ;
1243
- self . parent_scope . module = anonymous_module;
1244
- } else {
1245
- self . ribs [ ValueNS ] . push ( Rib :: new ( NormalRibKind ) ) ;
1246
- }
1247
-
1248
- // Descend into the block.
1249
- for stmt in & block. stmts {
1250
- if let StmtKind :: Item ( ref item) = stmt. node {
1251
- if let ItemKind :: MacroDef ( ..) = item. node {
1252
- num_macro_definition_ribs += 1 ;
1253
- let res = self . r . definitions . local_def_id ( item. id ) ;
1254
- self . ribs [ ValueNS ] . push ( Rib :: new ( MacroDefinition ( res) ) ) ;
1255
- self . label_ribs . push ( Rib :: new ( MacroDefinition ( res) ) ) ;
1256
- }
1257
- }
1258
-
1259
- self . visit_stmt ( stmt) ;
1260
- }
1261
-
1262
- // Move back up.
1263
- self . parent_scope . module = orig_module;
1264
- for _ in 0 .. num_macro_definition_ribs {
1265
- self . ribs [ ValueNS ] . pop ( ) ;
1266
- self . label_ribs . pop ( ) ;
1267
- }
1268
- self . ribs [ ValueNS ] . pop ( ) ;
1269
- if anonymous_module. is_some ( ) {
1270
- self . ribs [ TypeNS ] . pop ( ) ;
1271
- }
1272
- debug ! ( "(resolving block) leaving block" ) ;
1273
- }
1274
-
1275
1232
fn resolve_pattern (
1276
1233
& mut self ,
1277
1234
pat : & Pat ,
@@ -1729,6 +1686,49 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> {
1729
1686
self . with_resolved_label ( label, id, |this| this. visit_block ( block) ) ;
1730
1687
}
1731
1688
1689
+ fn resolve_block ( & mut self , block : & Block ) {
1690
+ debug ! ( "(resolving block) entering block" ) ;
1691
+ // Move down in the graph, if there's an anonymous module rooted here.
1692
+ let orig_module = self . parent_scope . module ;
1693
+ let anonymous_module = self . r . block_map . get ( & block. id ) . cloned ( ) ; // clones a reference
1694
+
1695
+ let mut num_macro_definition_ribs = 0 ;
1696
+ if let Some ( anonymous_module) = anonymous_module {
1697
+ debug ! ( "(resolving block) found anonymous module, moving down" ) ;
1698
+ self . ribs [ ValueNS ] . push ( Rib :: new ( ModuleRibKind ( anonymous_module) ) ) ;
1699
+ self . ribs [ TypeNS ] . push ( Rib :: new ( ModuleRibKind ( anonymous_module) ) ) ;
1700
+ self . parent_scope . module = anonymous_module;
1701
+ } else {
1702
+ self . ribs [ ValueNS ] . push ( Rib :: new ( NormalRibKind ) ) ;
1703
+ }
1704
+
1705
+ // Descend into the block.
1706
+ for stmt in & block. stmts {
1707
+ if let StmtKind :: Item ( ref item) = stmt. node {
1708
+ if let ItemKind :: MacroDef ( ..) = item. node {
1709
+ num_macro_definition_ribs += 1 ;
1710
+ let res = self . r . definitions . local_def_id ( item. id ) ;
1711
+ self . ribs [ ValueNS ] . push ( Rib :: new ( MacroDefinition ( res) ) ) ;
1712
+ self . label_ribs . push ( Rib :: new ( MacroDefinition ( res) ) ) ;
1713
+ }
1714
+ }
1715
+
1716
+ self . visit_stmt ( stmt) ;
1717
+ }
1718
+
1719
+ // Move back up.
1720
+ self . parent_scope . module = orig_module;
1721
+ for _ in 0 .. num_macro_definition_ribs {
1722
+ self . ribs [ ValueNS ] . pop ( ) ;
1723
+ self . label_ribs . pop ( ) ;
1724
+ }
1725
+ self . ribs [ ValueNS ] . pop ( ) ;
1726
+ if anonymous_module. is_some ( ) {
1727
+ self . ribs [ TypeNS ] . pop ( ) ;
1728
+ }
1729
+ debug ! ( "(resolving block) leaving block" ) ;
1730
+ }
1731
+
1732
1732
fn resolve_expr ( & mut self , expr : & Expr , parent : Option < & Expr > ) {
1733
1733
// First, record candidate traits for this expression if it could
1734
1734
// result in the invocation of a method call.
0 commit comments