about summary refs log tree commit diff
path: root/src/libstd/hashmap.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-11 16:19:42 -0700
committerbors <bors@rust-lang.org>2013-06-11 16:19:42 -0700
commit3f900dc7d1517bbc821989d68f3392d4aae96f93 (patch)
tree1f8c006deabe41787f5111c47c823c0d2fb12301 /src/libstd/hashmap.rs
parent1175e94de3b6d0f6b35fd8de3599b29267f1adab (diff)
parentbbe3d4a9dc7eae6b53871d0a59d56372c2c03479 (diff)
downloadrust-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/libstd/hashmap.rs')
-rw-r--r--src/libstd/hashmap.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/hashmap.rs b/src/libstd/hashmap.rs
index b1400d1bc76..7a9435d2ecd 100644
--- a/src/libstd/hashmap.rs
+++ b/src/libstd/hashmap.rs
@@ -20,6 +20,7 @@ use cmp::{Eq, Equiv};
 use hash::Hash;
 use old_iter::BaseIter;
 use old_iter;
+use iterator::{Iterator, IteratorUtil};
 use option::{None, Option, Some};
 use rand::RngUtil;
 use rand;
@@ -316,7 +317,7 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
     /// Visit all key-value pairs
     fn each<'a>(&'a self, blk: &fn(&K, &'a V) -> bool) -> bool {
         for self.buckets.each |bucket| {
-            for bucket.each |pair| {
+            for bucket.iter().advance |pair| {
                 if !blk(&pair.key, &pair.value) {
                     return false;
                 }