Skip to content

Commit ef199aa

Browse files
committed
---
yaml --- r: 122835 b: refs/heads/master c: 6bee3c8 h: refs/heads/master i: 122833: c16b907 122831: c2173c3 v: v3
1 parent a54138b commit ef199aa

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 35175f015ff878d49e3b5562fe3a7addcef25cfc
2+
refs/heads/master: 6bee3c87c94a39fb7d48a119bbc105149c345bfc
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: aaff4e05e19b48d81e4ecb3337f288f42d06edd0
55
refs/heads/try: 2e9d9477b848cec778ca3f07ecdf0aea6ade23de

trunk/src/libsyntax/ext/expand.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -667,19 +667,14 @@ fn expand_arm(arm: &ast::Arm, fld: &mut MacroExpander) -> ast::Arm {
667667
// code duplicated from 'let', above. Perhaps this can be lifted
668668
// into a separate function:
669669
let idents = pattern_bindings(*first_pat);
670-
let mut new_pending_renames =
670+
let new_pending_renames =
671671
idents.iter().map(|id| (*id,fresh_name(id))).collect();
672-
// rewrite all of the patterns using the new names (the old
673-
// ones have already been applied). Note that we depend here
674-
// on the guarantee that after expansion, there can't be any
675-
// Path expressions (a.k.a. varrefs) left in the pattern. If
676-
// this were false, we'd need to apply this renaming only to
677-
// the bindings, and not to the varrefs, using a more targeted
678-
// fold-er.
679-
let mut rename_fld = IdentRenamer{renames:&mut new_pending_renames};
672+
// apply the renaming, but only to the PatIdents:
673+
let mut rename_pats_fld = PatIdentRenamer{renames:&new_pending_renames};
680674
let rewritten_pats =
681-
expanded_pats.iter().map(|pat| rename_fld.fold_pat(*pat)).collect();
675+
expanded_pats.iter().map(|pat| rename_pats_fld.fold_pat(*pat)).collect();
682676
// apply renaming and then expansion to the guard and the body:
677+
let mut rename_fld = IdentRenamer{renames:&new_pending_renames};
683678
let rewritten_guard =
684679
arm.guard.map(|g| fld.fold_expr(rename_fld.fold_expr(g)));
685680
let rewritten_body = fld.fold_expr(rename_fld.fold_expr(arm.body));

0 commit comments

Comments
 (0)