Skip to content

Commit 58dd343

Browse files
authored
Merge pull request #58652 from lorentey/hashable-doc-clarifications
[stdlib][docs] Slightly clarify Hashable docs
2 parents 92a1c4b + e285c41 commit 58dd343

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/public/core/Hashable.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public protocol Hashable: Equatable {
109109
///
110110
/// - Important: `hashValue` is deprecated as a `Hashable` requirement. To
111111
/// conform to `Hashable`, implement the `hash(into:)` requirement instead.
112+
/// (The compiler will provide an implementation for `hashValue` for you.)
112113
var hashValue: Int { get }
113114

114115
/// Hashes the essential components of this value by feeding them into the
@@ -119,8 +120,9 @@ public protocol Hashable: Equatable {
119120
/// in your type's `==` operator implementation. Call `hasher.combine(_:)`
120121
/// with each of these components.
121122
///
122-
/// - Important: Never call `finalize()` on `hasher`. Doing so may become a
123-
/// compile-time error in the future.
123+
/// - Important: `hash(into:)` implementations must never call `finalize()` on
124+
/// the `hasher` instance provided, or replace it with a different
125+
/// instance. Doing so may become compile-time errors in the future.
124126
///
125127
/// - Parameter hasher: The hasher to use when combining the components
126128
/// of this instance.

0 commit comments

Comments
 (0)