File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 11
2+ /**
3+ non-atomic
4+ */
25public final class _BackingStorage < Value> : @unchecked Sendable {
36
47 public var value : Value
@@ -15,6 +18,11 @@ extension _BackingStorage: Equatable where Value: Equatable {
1518 }
1619}
1720
21+ extension _BackingStorage : Hashable where Value: Hashable {
22+ public func hash( into hasher: inout Hasher ) {
23+ value. hash ( into: & hasher)
24+ }
25+ }
1826
1927#if DEBUG
2028private struct Before {
Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ public macro COWTrackingProperty() =
5757 var count : Int = 0
5858 }
5959
60+ @Tracking
61+ struct HashableState : Hashable {
62+ var count : Int = 0
63+ }
64+
6065 @Tracking
6166 struct MyState {
6267
Original file line number Diff line number Diff line change @@ -10,14 +10,18 @@ extension Array {
1010}
1111
1212
13- public final class _TrackingContext : Sendable , Equatable {
13+ public final class _TrackingContext : Sendable , Hashable {
1414
1515 public static func == ( lhs: _TrackingContext , rhs: _TrackingContext ) -> Bool {
1616 // ``_TrackingContext`` is used only for embedding into the struct.
1717 // It always returns true when checked for equality to prevent
1818 // interfering with the actual equality check of the struct.
1919 return true
2020 }
21+
22+ public func hash( into hasher: inout Hasher ) {
23+ 0 . hash ( into: & hasher)
24+ }
2125
2226 @inlinable
2327 public var path : PropertyPath ? {
You can’t perform that action at this time.
0 commit comments