@@ -504,6 +504,13 @@ pub fn expand_item_mac(it: P<ast::Item>,
504
504
505
505
/// Expand a stmt
506
506
fn expand_stmt ( stmt : Stmt , fld : & mut MacroExpander ) -> SmallVector < Stmt > {
507
+ // perform all pending renames
508
+ let stmt = {
509
+ let pending_renames = & mut fld. cx . syntax_env . info ( ) . pending_renames ;
510
+ let mut rename_fld = IdentRenamer { renames : pending_renames} ;
511
+ rename_fld. fold_stmt ( stmt) . expect_one ( "rename_fold didn't return one value" )
512
+ } ;
513
+
507
514
let ( mac, style, attrs) = match stmt. node {
508
515
StmtKind :: Mac ( mac, style, attrs) => ( mac, style, attrs) ,
509
516
_ => return expand_non_macro_stmt ( stmt, fld)
@@ -717,14 +724,8 @@ pub fn expand_block(blk: P<Block>, fld: &mut MacroExpander) -> P<Block> {
717
724
pub fn expand_block_elts ( b : P < Block > , fld : & mut MacroExpander ) -> P < Block > {
718
725
b. map ( |Block { id, stmts, expr, rules, span} | {
719
726
let new_stmts = stmts. into_iter ( ) . flat_map ( |x| {
720
- // perform all pending renames
721
- let renamed_stmt = {
722
- let pending_renames = & mut fld. cx . syntax_env . info ( ) . pending_renames ;
723
- let mut rename_fld = IdentRenamer { renames : pending_renames} ;
724
- rename_fld. fold_stmt ( x) . expect_one ( "rename_fold didn't return one value" )
725
- } ;
726
- // expand macros in the statement
727
- fld. fold_stmt ( renamed_stmt) . into_iter ( )
727
+ // perform pending renames and expand macros in the statement
728
+ fld. fold_stmt ( x) . into_iter ( )
728
729
} ) . collect ( ) ;
729
730
let new_expr = expr. map ( |x| {
730
731
let expr = {
0 commit comments