Skip to content

Commit

Permalink
std: Set probe length tag on cloned hashmaps
Browse files Browse the repository at this point in the history
This isn't strictly necessary for hashmap cloning to work. The tag is
used to hint for an upcoming resize, so it's good to copy this
information over.

(We can do cleverer things like actually resizing the hashmap when we
see the tag, or even cleaning up the entry order, but this requires
more thought and might not be worth it)
  • Loading branch information
Manishearth committed Oct 14, 2017
1 parent bb9e850 commit e8e7715
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/libstd/collections/hash/table.rs
Expand Up @@ -1156,6 +1156,7 @@ impl<K: Clone, V: Clone> Clone for RawTable<K, V> {
}

new_ht.size = self.size();
new_ht.set_tag(self.tag());

new_ht
}
Expand Down

0 comments on commit e8e7715

Please sign in to comment.