File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -397,7 +397,7 @@ extension CGFloat : Hashable {
397
397
hasher. combine ( native)
398
398
}
399
399
400
- @inlinable @ _transparent
400
+ @_alwaysEmitIntoClient @ inlinable // Introduced in 5.1
401
401
public func _rawHashValue( seed: Int ) -> Int {
402
402
return native. _rawHashValue ( seed: seed)
403
403
}
Original file line number Diff line number Diff line change @@ -51,11 +51,31 @@ extension String {
51
51
}
52
52
53
53
extension String . Encoding : Hashable {
54
+ public var hashValue : Int {
55
+ // Note: This is effectively the same hashValue definition that
56
+ // RawRepresentable provides on its own. We only need to keep this to
57
+ // ensure ABI compatibility with 5.0.
58
+ return rawValue. hashValue
59
+ }
60
+
61
+ @_alwaysEmitIntoClient // Introduced in 5.1
54
62
public func hash( into hasher: inout Hasher ) {
63
+ // Note: `hash(only:)` is only defined here because we also define
64
+ // `hashValue`.
65
+ //
66
+ // In 5.0, `hash(into:)` was resolved to RawRepresentable's functionally
67
+ // equivalent definition; we added this definition in 5.1 to make it
68
+ // clear this `hash(into:)` isn't synthesized by the compiler.
69
+ // (Otherwise someone may be tempted to define it, possibly breaking the
70
+ // hash encoding and thus the ABI. RawRepresentable's definition is
71
+ // inlinable.)
55
72
hasher. combine ( rawValue)
56
73
}
57
74
58
75
public static func == ( lhs: String . Encoding , rhs: String . Encoding ) -> Bool {
76
+ // Note: This is effectively the same == definition that
77
+ // RawRepresentable provides on its own. We only need to keep this to
78
+ // ensure ABI compatibility with 5.0.
59
79
return lhs. rawValue == rhs. rawValue
60
80
}
61
81
}
You can’t perform that action at this time.
0 commit comments