fn expand_arm(arm: ast::Arm, fld: &mut MacroExpander) -> ast::Arm {
    // expand pats... they might contain macro uses:
    let expanded_pats = arm.pats.move_map(|pat| fld.fold_pat(pat));
    if expanded_pats.is_empty() {
        panic!("encountered match arm with 0 patterns");
    }
    // all of the pats must have the same set of bindings, so use the
    // first one to extract them and generate new names:
    let idents = pattern_bindings(&*expanded_pats[0]);
    let new_renames = idents.into_iter().map(|id| (id, fresh_name(&id))).collect();
    // apply the renaming, but only to the PatIdents:
    let mut rename_pats_fld = PatIdentRenamer{renames:&new_renames};
    let rewritten_pats = expanded_pats.move_map(|pat| rename_pats_fld.fold_pat(pat));
    // apply renaming and then expansion to the guard and the body:
    let mut rename_fld = IdentRenamer{renames:&new_renames};
    let rewritten_guard =
        arm.guard.map(|g| fld.fold_expr(rename_fld.fold_expr(g)));
    let rewritten_body = fld.fold_expr(rename_fld.fold_expr(arm.body));
    ast::Arm {
        attrs: fold::fold_attrs(arm.attrs, fld),
        pats: rewritten_pats,
        guard: rewritten_guard,
        body: rewritten_body,
    }
}
// expand the arm of a 'match', renaming for macro hygiene
expand the arm of a 'match', renaming for macro hygiene
expand the arm of a ' match ' renaming for macro hygiene
fn expand_arm(arm: ast::Arm, fld: &mut MacroExpander) -> ast::Arm {
    // expand pats... they might contain macro uses:
    let expanded_pats = arm.pats.move_map(|pat| fld.fold_pat(pat));
    if expanded_pats.is_empty() {
        panic!("encountered match arm with 0 patterns");
    }
    // all of the pats must have the same set of bindings, so use the
    // first one to extract them and generate new names:
    let idents = pattern_bindings(&*expanded_pats[0]);
    let new_renames = idents.into_iter().map(|id| (id, fresh_name(&id))).collect();
    // apply the renaming, but only to the PatIdents:
    let mut rename_pats_fld = PatIdentRenamer{renames:&new_renames};
    let rewritten_pats = expanded_pats.move_map(|pat| rename_pats_fld.fold_pat(pat));
    // apply renaming and then expansion to the guard and the body:
    let mut rename_fld = IdentRenamer{renames:&new_renames};
    let rewritten_guard =
        arm.guard.map(|g| fld.fold_expr(rename_fld.fold_expr(g)));
    let rewritten_body = fld.fold_expr(rename_fld.fold_expr(arm.body));
    ast::Arm {
        attrs: fold::fold_attrs(arm.attrs, fld),
        pats: rewritten_pats,
        guard: rewritten_guard,
        body: rewritten_body,
    }
}
fn expand_arm ( arm : ast :: Arm , fld : & mut MacroExpander ) -> ast :: Arm { // expand pats... they might contain macro uses: let expanded_pats = arm . pats . move_map ( | pat | fld . fold_pat ( pat ) ) ; if expanded_pats . is_empty ( ) { panic ! ( " " ) ; } // all of the pats must have the same set of bindings, so use the // first one to extract them and generate new names: let idents = pattern_bindings ( & * expanded_pats [ 0 ] ) ; let new_renames = idents . into_iter ( ) . map ( | id | ( id , fresh_name ( & id ) ) ) . collect ( ) ; // apply the renaming, but only to the PatIdents: let mut rename_pats_fld = PatIdentRenamer { renames : & new_renames } ; let rewritten_pats = expanded_pats . move_map ( | pat | rename_pats_fld . fold_pat ( pat ) ) ; // apply renaming and then expansion to the guard and the body: let mut rename_fld = IdentRenamer { renames : & new_renames } ; let rewritten_guard = arm . guard . map ( | g | fld . fold_expr ( rename_fld . fold_expr ( g ) ) ) ; let rewritten_body = fld . fold_expr ( rename_fld . fold_expr ( arm . body ) ) ; ast :: Arm { attrs : fold :: fold_attrs ( arm . attrs , fld ) , pats : rewritten_pats , guard : rewritten_guard , body : rewritten_body , } }
expand the arm of a 'match', renaming for macro hygiene
expand the arm of a ' match ' renaming for macro hygiene
arm
ast::Arm
fld
&mut MacroExpander
arm
ast::Arm
fld
&mut MacroExpander