diff options
| author | bors <bors@rust-lang.org> | 2013-06-11 16:19:42 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-06-11 16:19:42 -0700 |
| commit | 3f900dc7d1517bbc821989d68f3392d4aae96f93 (patch) | |
| tree | 1f8c006deabe41787f5111c47c823c0d2fb12301 /src/libsyntax/ext | |
| parent | 1175e94de3b6d0f6b35fd8de3599b29267f1adab (diff) | |
| parent | bbe3d4a9dc7eae6b53871d0a59d56372c2c03479 (diff) | |
| download | rust-3f900dc7d1517bbc821989d68f3392d4aae96f93.tar.gz rust-3f900dc7d1517bbc821989d68f3392d4aae96f93.zip | |
auto merge of #7055 : thestinger/rust/iterator, r=catamorphism
This was a lot more painful than just changing `x.each` to `x.iter().advance` . I ran into my old friend #5898 and had to add underscores to some method names as a temporary workaround. The borrow checker also had other ideas because rvalues aren't handled very well yet so temporary variables had to be added. However, storing the temporary in a variable led to dynamic `@mut` failures, so those had to be wrapped in blocks except where the scope ends immediately. Anyway, the ugliness will be fixed as the compiler issues are fixed and this change will amount to `for x.each |x|` becoming `for x.iter |x|` and making all the iterator adaptors available. I dropped the run-pass tests for `old_iter` because there's not much point in fixing a module that's on the way out in the next week or so.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 1e1f411c050..96ea5ecf92c 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -384,7 +384,9 @@ pub fn new_name_finder() -> @Visitor<@mut ~[ast::ident]> { _ => () } // visit optional subpattern of pat_ident: - for inner.each |subpat: &@ast::pat| { (v.visit_pat)(*subpat, ident_accum, v) } + for inner.iter().advance |subpat: &@ast::pat| { + (v.visit_pat)(*subpat, ident_accum, v) + } } // use the default traversal for non-pat_idents _ => visit::visit_pat(p,ident_accum,v) |
