]> git.lizzy.rs Git - rust.git/blobdiff - library/alloc/src/collections/btree/map.rs
BTreeSet->BTreeMap (fix copy/paste mistake in documentation)
[rust.git] / library / alloc / src / collections / btree / map.rs
index c178d3e3b03c918cfa83f7b36e10f776a57dbe00..6027991a0ed2fbb9b1e518ba7e937e6fde87ddae 100644 (file)
@@ -64,9 +64,9 @@
 /// It is a logic error for a key to be modified in such a way that the key's ordering relative to
 /// any other key, as determined by the [`Ord`] trait, changes while it is in the map. This is
 /// normally only possible through [`Cell`], [`RefCell`], global state, I/O, or unsafe code.
-/// The behavior resulting from such a logic error is not specified (it could include panics,
-/// incorrect results, aborts, memory leaks, or non-termination) but will not be undefined
-/// behavior.
+/// The behavior resulting from such a logic error is not specified, but will be encapsulated to the
+/// `BTreeMap` that observed the logic error and not result in undefined behavior. This could
+/// include panics, incorrect results, aborts, memory leaks, and non-termination.
 ///
 /// Iterators obtained from functions such as [`BTreeMap::iter`], [`BTreeMap::values`], or
 /// [`BTreeMap::keys`] produce their items in order by key, and take worst-case logarithmic and
@@ -1990,7 +1990,7 @@ fn extend_one(&mut self, (&k, &v): (&'a K, &'a V)) {
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<K: Hash, V: Hash> Hash for BTreeMap<K, V> {
     fn hash<H: Hasher>(&self, state: &mut H) {
-        self.len().hash(state);
+        state.write_length_prefix(self.len());
         for elt in self {
             elt.hash(state);
         }