about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-01-29 11:16:39 -0500
committerAlex Crichton <alex@alexcrichton.com>2013-01-29 11:16:39 -0500
commit810eeef444d0f0b56d6fdc44dbfa10e7f155bd0a (patch)
tree9845f2464c0cfc944459eb64e389a90cb283a57c /src
parentfc9650b1467a7388e60838ddbeb1755d5fe149b5 (diff)
downloadrust-810eeef444d0f0b56d6fdc44dbfa10e7f155bd0a.tar.gz
rust-810eeef444d0f0b56d6fdc44dbfa10e7f155bd0a.zip
Fix the len() method on LinearMap during popping
Diffstat (limited to 'src')
-rw-r--r--src/libcore/hashmap.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs
index 47f0fcfd381..27b5ddadff9 100644
--- a/src/libcore/hashmap.rs
+++ b/src/libcore/hashmap.rs
@@ -220,6 +220,9 @@ pub mod linear {
                 },
             };
 
+            /* re-inserting buckets may cause changes in size, so remember what
+               our new size is ahead of time before we start insertions */
+            let size = self.size - 1;
             idx = self.next_bucket(idx, len_buckets);
             while self.buckets[idx].is_some() {
                 let mut bucket = None;
@@ -227,7 +230,7 @@ pub mod linear {
                 self.insert_opt_bucket(bucket);
                 idx = self.next_bucket(idx, len_buckets);
             }
-            self.size -= 1;
+            self.size = size;
 
             value
         }