Skip to content

Commit e8e7715

Browse files
committed
std: Set probe length tag on cloned hashmaps
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)
1 parent bb9e850 commit e8e7715

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libstd/collections/hash/table.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ impl<K: Clone, V: Clone> Clone for RawTable<K, V> {
11561156
}
11571157

11581158
new_ht.size = self.size();
1159+
new_ht.set_tag(self.tag());
11591160

11601161
new_ht
11611162
}

0 commit comments

Comments
 (0)