Skip to content

Commit 1760e87

Browse files
committed
Auto merge of rust-lang#23342 - apasel422:23327, r=alexcrichton
closes rust-lang#23327
2 parents bde09ee + 90f06ae commit 1760e87

File tree

6 files changed

+29
-0
lines changed

6 files changed

+29
-0
lines changed

src/libcollections/binary_heap.rs

+5
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ use vec::{self, Vec};
163163
/// A priority queue implemented with a binary heap.
164164
///
165165
/// This will be a max-heap.
166+
///
167+
/// It is a logic error for an item to be modified in such a way that the
168+
/// item's ordering relative to any other item, as determined by the `Ord`
169+
/// trait, changes while it is in the heap. This is normally only possible
170+
/// through `Cell`, `RefCell`, global state, I/O, or unsafe code.
166171
#[derive(Clone)]
167172
#[stable(feature = "rust1", since = "1.0.0")]
168173
pub struct BinaryHeap<T> {

src/libcollections/btree/map.rs

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ use super::node::{self, Node, Found, GoDown};
6464
/// and possibly other factors. Using linear search, searching for a random element is expected
6565
/// to take O(B log<sub>B</sub>n) comparisons, which is generally worse than a BST. In practice,
6666
/// however, performance is excellent.
67+
///
68+
/// It is a logic error for a key to be modified in such a way that the key's ordering relative to
69+
/// any other key, as determined by the `Ord` trait, changes while it is in the map. This is
70+
/// normally only possible through `Cell`, `RefCell`, global state, I/O, or unsafe code.
6771
#[derive(Clone)]
6872
#[stable(feature = "rust1", since = "1.0.0")]
6973
pub struct BTreeMap<K, V> {

src/libcollections/btree/set.rs

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ use Bound;
3030
///
3131
/// See BTreeMap's documentation for a detailed discussion of this collection's performance
3232
/// benefits and drawbacks.
33+
///
34+
/// It is a logic error for an item to be modified in such a way that the item's ordering relative
35+
/// to any other item, as determined by the `Ord` trait, changes while it is in the set. This is
36+
/// normally only possible through `Cell`, `RefCell`, global state, I/O, or unsafe code.
3337
#[derive(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
3438
#[stable(feature = "rust1", since = "1.0.0")]
3539
pub struct BTreeSet<T>{

src/libcollections/enum_set.rs

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ use core::ops::{Sub, BitOr, BitAnd, BitXor};
2424

2525
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
2626
/// A specialized set implementation to use enum types.
27+
///
28+
/// It is a logic error for an item to be modified in such a way that the transformation of the
29+
/// item to or from a `usize`, as determined by the `CLike` trait, changes while the item is in the
30+
/// set. This is normally only possible through `Cell`, `RefCell`, global state, I/O, or unsafe
31+
/// code.
2732
pub struct EnumSet<E> {
2833
// We must maintain the invariant that no bits are set
2934
// for which no variant exists

src/libstd/collections/hash/map.rs

+5
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ fn test_resize_policy() {
217217
/// It is required that the keys implement the `Eq` and `Hash` traits, although
218218
/// this can frequently be achieved by using `#[derive(Eq, Hash)]`.
219219
///
220+
/// It is a logic error for a key to be modified in such a way that the key's
221+
/// hash, as determined by the `Hash` trait, or its equality, as determined by
222+
/// the `Eq` trait, changes while it is in the map. This is normally only
223+
/// possible through `Cell`, `RefCell`, global state, I/O, or unsafe code.
224+
///
220225
/// Relevant papers/articles:
221226
///
222227
/// 1. Pedro Celis. ["Robin Hood Hashing"](https://cs.uwaterloo.ca/research/tr/1986/CS-86-14.pdf)

src/libstd/collections/hash/set.rs

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ use super::state::HashState;
3838
/// HashMap where the value is (). As with the `HashMap` type, a `HashSet`
3939
/// requires that the elements implement the `Eq` and `Hash` traits.
4040
///
41+
/// It is a logic error for an item to be modified in such a way that the
42+
/// item's hash, as determined by the `Hash` trait, or its equality, as
43+
/// determined by the `Eq` trait, changes while it is in the set. This is
44+
/// normally only possible through `Cell`, `RefCell`, global state, I/O, or
45+
/// unsafe code.
46+
///
4147
/// # Examples
4248
///
4349
/// ```

0 commit comments

Comments
 (0)