fn expand_loop_block(loop_block: P<Block>,
                     opt_ident: Option<Ident>,
                     fld: &mut MacroExpander) -> (P<Block>, Option<Ident>) {
    match opt_ident {
        Some(label) => {
            let new_label = fresh_name(&label);
            let rename = (label, new_label);

            // The rename *must not* be added to the pending list of current
            // syntax context otherwise an unrelated `break` or `continue` in
            // the same context will pick that up in the deferred renaming pass
            // and be renamed incorrectly.
            let mut rename_list = vec!(rename);
            let mut rename_fld = IdentRenamer{renames: &mut rename_list};
            let renamed_ident = rename_fld.fold_ident(label);

            // The rename *must* be added to the enclosed syntax context for
            // `break` or `continue` to pick up because by definition they are
            // in a block enclosed by loop head.
            fld.cx.syntax_env.push_frame();
            fld.cx.syntax_env.info().pending_renames.push(rename);
            let expanded_block = expand_block_elts(loop_block, fld);
            fld.cx.syntax_env.pop_frame();

            (expanded_block, Some(renamed_ident))
        }
        None => (fld.fold_block(loop_block), opt_ident)
    }
}
/// Rename loop label and expand its loop body
///
/// The renaming procedure for loop is different in the sense that the loop
/// body is in a block enclosed by loop head so the renaming of loop label
/// must be propagated to the enclosed context.
Rename loop label and expand its loop body
The renaming procedure for loop is different in the sense that the loop
body is in a block enclosed by loop head so the renaming of loop label
must be propagated to the enclosed context.
Rename loop label and expand its loop body The renaming procedure for loop is different in the sense that the loop body is in a block enclosed by loop head so the renaming of loop label must be propagated to the enclosed context .
fn expand_loop_block(loop_block: P<Block>,
                     opt_ident: Option<Ident>,
                     fld: &mut MacroExpander) -> (P<Block>, Option<Ident>) {
    match opt_ident {
        Some(label) => {
            let new_label = fresh_name(&label);
            let rename = (label, new_label);
            // The rename *must not* be added to the pending list of current
            // syntax context otherwise an unrelated `break` or `continue` in
            // the same context will pick that up in the deferred renaming pass
            // and be renamed incorrectly.
            let mut rename_list = vec!(rename);
            let mut rename_fld = IdentRenamer{renames: &mut rename_list};
            let renamed_ident = rename_fld.fold_ident(label);
            // The rename *must* be added to the enclosed syntax context for
            // `break` or `continue` to pick up because by definition they are
            // in a block enclosed by loop head.
            fld.cx.syntax_env.push_frame();
            fld.cx.syntax_env.info().pending_renames.push(rename);
            let expanded_block = expand_block_elts(loop_block, fld);
            fld.cx.syntax_env.pop_frame();
            (expanded_block, Some(renamed_ident))
        }
        None => (fld.fold_block(loop_block), opt_ident)
    }
}
fn expand_loop_block ( loop_block : P < Block > , opt_ident : Option < Ident > , fld : & mut MacroExpander ) -> ( P < Block > , Option < Ident > ) { match opt_ident { Some ( label ) => { let new_label = fresh_name ( & label ) ; let rename = ( label , new_label ) ; // The rename *must not* be added to the pending list of current // syntax context otherwise an unrelated `break` or `continue` in // the same context will pick that up in the deferred renaming pass // and be renamed incorrectly. let mut rename_list = vec ! ( rename ) ; let mut rename_fld = IdentRenamer { renames : & mut rename_list } ; let renamed_ident = rename_fld . fold_ident ( label ) ; // The rename *must* be added to the enclosed syntax context for // `break` or `continue` to pick up because by definition they are // in a block enclosed by loop head. fld . cx . syntax_env . push_frame ( ) ; fld . cx . syntax_env . info ( ) . pending_renames . push ( rename ) ; let expanded_block = expand_block_elts ( loop_block , fld ) ; fld . cx . syntax_env . pop_frame ( ) ; ( expanded_block , Some ( renamed_ident ) ) } None => ( fld . fold_block ( loop_block ) , opt_ident ) } }
Rename loop label and expand its loop body
The renaming procedure for loop is different in the sense that the loop
body is in a block enclosed by loop head so the renaming of loop label
must be propagated to the enclosed context.
Rename loop label and expand its loop body The renaming procedure for loop is different in the sense that the loop body is in a block enclosed by loop head so the renaming of loop label must be propagated to the enclosed context .
loop_block
P<Block>
opt_ident
Option<Ident>
fld
&mut MacroExpander
loop_block
P<Block>
opt_ident
Option<Ident>
fld
&mut MacroExpander