File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -153,10 +153,14 @@ mod uninit;
153153/// Standard library collections such as
154154/// [`HashMap`], [`HashSet`], [`BTreeMap`], [`BTreeSet`] and [`BinaryHeap`]
155155/// rely on their keys respecting this property for correct behavior.
156- ///
157- /// This property is automatically satisfied when deriving both `Clone` and [`PartialEq`]
158- /// using `#[derive(Clone, PartialEq)]` or when additionally deriving [`Eq`]
159- /// using `#[derive(Clone, PartialEq, Eq)]`.
156+ /// Furthermore, these collections require that cloning a key preserves the outcome of the
157+ /// [`Hash`] and [`Ord`] methods. Thankfully, this follows automatically from `x.clone() == x`
158+ /// if `Hash` and `Ord` are correctly implemented according to their own requirements.
159+ ///
160+ /// When deriving both `Clone` and [`PartialEq`] using `#[derive(Clone, PartialEq)]`
161+ /// or when additionally deriving [`Eq`] using `#[derive(Clone, PartialEq, Eq)]`,
162+ /// then this property is automatically upheld – provided that it is satisfied by
163+ /// the underlying types.
160164///
161165/// Violating this property is a logic error. The behavior resulting from a logic error is not
162166/// specified, but users of the trait must ensure that such logic errors do *not* result in
You can’t perform that action at this time.
0 commit comments