Skip to content

Commit 6c6ed33

Browse files
authored
Remove Sendability from all Iterators (#219)
# Motivation We have been discussing this a lot in the other PRs, but in general said that an `AsyncIterator` is the connection between the consuming task and the `AsyncSequence`. If an `AsyncIterator` would be `Sendable` then we don't have that relationship anymore. Therefore, no iterator of an `AsyncIterator` should be `Sendable`. # Modification Remove all `Sendable` conformances of the iterators even the conditional ones. We can always add them back later.
1 parent 2cfb166 commit 6c6ed33

16 files changed

+28
-57
lines changed
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
| Type | Throws | Sendability |
22
|-----------------------------------------------------|--------------|-------------|
33
| `AsyncAdjacentPairsSequence` | rethrows | Conditional |
4-
| `AsyncBufferedByteIterator` | throws | Sendable |
4+
| `AsyncBufferedByteIterator` | throws | Not Sendable|
55
| `AsyncBufferSequence` | rethrows | Conditional |
6-
| `AsyncBufferSequence.Iterator` | rethrows | Conditional |
6+
| `AsyncBufferSequence.Iterator` | rethrows | Not Sendable|
77
| `AsyncChain2Sequence` | rethrows | Conditional |
8-
| `AsyncChain2Sequence.Iterator` | rethrows | Conditional |
8+
| `AsyncChain2Sequence.Iterator` | rethrows | Not Sendable|
99
| `AsyncChain3Sequence` | rethrows | Conditional |
10-
| `AsyncChain3Sequence.Iterator` | rethrows | Conditional |
10+
| `AsyncChain3Sequence.Iterator` | rethrows | Not Sendable|
1111
| `AsyncChannel` | non-throwing | Sendable |
12-
| `AsyncChannel.Iterator` | non-throwing | Sendable |
12+
| `AsyncChannel.Iterator` | non-throwing | Not Sendable|
1313
| `AsyncChunkedByGroupSequence` | rethrows | Conditional |
14-
| `AsyncChunkedByGroupSequence.Iterator` | rethrows | Conditional |
14+
| `AsyncChunkedByGroupSequence.Iterator` | rethrows | Not Sendable|
1515
| `AsyncChunkedOnProjectionSequence` | rethrows | Conditional |
16-
| `AsyncChunkedOnProjectionSequence.Iterator` | rethrows | Conditional |
16+
| `AsyncChunkedOnProjectionSequence.Iterator` | rethrows | Not Sendable|
1717
| `AsyncChunksOfCountOrSignalSequence` | rethrows | Sendable |
18-
| `AsyncChunksOfCountOrSignalSequence.Iterator` | rethrows | Sendable |
18+
| `AsyncChunksOfCountOrSignalSequence.Iterator` | rethrows | Not Sendable|
1919
| `AsyncChunksOfCountSequence` | rethrows | Conditional |
20-
| `AsyncChunksOfCountSequence.Iterator` | rethrows | Conditional |
20+
| `AsyncChunksOfCountSequence.Iterator` | rethrows | Not Sendable|
2121
| `AsyncCombineLatest2Sequence` | rethrows | Sendable |
22-
| `AsyncCombineLatest2Sequence.Iterator` | rethrows | Sendable |
22+
| `AsyncCombineLatest2Sequence.Iterator` | rethrows | Not Sendable|
2323
| `AsyncCombineLatest3Sequence` | rethrows | Sendable |
24-
| `AsyncCombineLatest3Sequence.Iterator` | rethrows | Sendable |
24+
| `AsyncCombineLatest3Sequence.Iterator` | rethrows | Not Sendable|
2525
| `AsyncCompactedSequence` | rethrows | Conditional |
26-
| `AsyncCompactedSequence.Iterator` | rethrows | Conditional |
26+
| `AsyncCompactedSequence.Iterator` | rethrows | Not Sendable|
2727
| `AsyncDebounceSequence` | rethrows | Sendable |
28-
| `AsyncDebounceSequence.Iterator` | rethrows | Sendable |
28+
| `AsyncDebounceSequence.Iterator` | rethrows | Not Sendable|
2929
| `AsyncExclusiveReductionsSequence` | rethrows | Conditional |
30-
| `AsyncExclusiveReductionsSequence.Iterator` | rethrows | Conditional |
30+
| `AsyncExclusiveReductionsSequence.Iterator` | rethrows | Not Sendable|
3131
| `AsyncInclusiveReductionsSequence` | rethrows | Conditional |
32-
| `AsyncInclusiveReductionsSequence.Iterator` | rethrows | Conditional |
32+
| `AsyncInclusiveReductionsSequence.Iterator` | rethrows | Not Sendable|
3333
| `AsyncInterspersedSequence` | rethrows | Conditional |
34-
| `AsyncInterspersedSequence.Iterator` | rethrows | Conditional |
34+
| `AsyncInterspersedSequence.Iterator` | rethrows | Not Sendable|
3535
| `AsyncJoinedSequence` | rethrows | Conditional |
36-
| `AsyncJoinedSequence.Iterator` | rethrows | Conditional |
36+
| `AsyncJoinedSequence.Iterator` | rethrows | Not Sendable|
3737
| `AsyncLazySequence` | non-throwing | Conditional |
38-
| `AsyncLazySequence.Iterator` | non-throwing | Conditional |
38+
| `AsyncLazySequence.Iterator` | non-throwing | Not Sendable|
3939
| `AsyncLimitBuffer` | non-throwing | Sendable |
4040
| `AsyncMerge2Sequence` | rethrows | Sendable |
41-
| `AsyncMerge2Sequence.Iterator` | rethrows | Sendable |
41+
| `AsyncMerge2Sequence.Iterator` | rethrows | Not Sendable|
4242
| `AsyncMerge3Sequence` | rethrows | Sendable |
43-
| `AsyncMerge3Sequence.Iterator` | rethrows | Sendable |
43+
| `AsyncMerge3Sequence.Iterator` | rethrows | Not Sendable|
4444
| `AsyncRemoveDuplicatesSequence` | rethrows | Conditional |
45-
| `AsyncRemoveDuplicatesSequence.Iterator` | rethrows | Conditional |
45+
| `AsyncRemoveDuplicatesSequence.Iterator` | rethrows | Not Sendable|
4646
| `AsyncThrottleSequence` | rethrows | Conditional |
47-
| `AsyncThrottleSequence.Iterator` | rethrows | Conditional |
47+
| `AsyncThrottleSequence.Iterator` | rethrows | Not Sendable|
4848
| `AsyncThrowingChannel` | throws | Sendable |
49-
| `AsyncThrowingChannel.Iterator` | throws | Sendable |
49+
| `AsyncThrowingChannel.Iterator` | throws | Not Sendable|
5050
| `AsyncThrowingExclusiveReductionsSequence` | throws | Conditional |
51-
| `AsyncThrowingExclusiveReductionsSequence.Iterator` | throws | Conditional |
51+
| `AsyncThrowingExclusiveReductionsSequence.Iterator` | throws | Not Sendable|
5252
| `AsyncThrowingInclusiveReductionsSequence` | throws | Conditional |
53-
| `AsyncThrowingInclusiveReductionsSequence.Iterator` | throws | Conditional |
53+
| `AsyncThrowingInclusiveReductionsSequence.Iterator` | throws | Not Sendable|
5454
| `AsyncTimerSequence` | non-throwing | Sendable |
55-
| `AsyncTimerSequence.Iterator` | non-throwing | Sendable |
55+
| `AsyncTimerSequence.Iterator` | non-throwing | Not Sendable|
5656
| `AsyncZip2Sequence` | rethrows | Sendable |
57-
| `AsyncZip2Sequence.Iterator` | rethrows | Sendable |
57+
| `AsyncZip2Sequence.Iterator` | rethrows | Not Sendable|
5858
| `AsyncZip3Sequence` | rethrows | Sendable |
59-
| `AsyncZip3Sequence.Iterator` | rethrows | Sendable |
59+
| `AsyncZip3Sequence.Iterator` | rethrows | Not Sendable|

Sources/AsyncAlgorithms/AsyncBufferSequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ public struct AsyncBufferSequence<Base: AsyncSequence, Buffer: AsyncBuffer> wher
235235
}
236236

237237
extension AsyncBufferSequence: Sendable where Base: Sendable { }
238-
extension AsyncBufferSequence.Iterator: Sendable where Base: Sendable { }
239238

240239
extension AsyncBufferSequence: AsyncSequence {
241240
public typealias Element = Buffer.Output

Sources/AsyncAlgorithms/AsyncChain3Sequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,3 @@ extension AsyncChain3Sequence: AsyncSequence {
9595
}
9696

9797
extension AsyncChain3Sequence: Sendable where Base1: Sendable, Base2: Sendable, Base3: Sendable { }
98-
extension AsyncChain3Sequence.Iterator: Sendable where Base1.AsyncIterator: Sendable, Base2.AsyncIterator: Sendable, Base3.AsyncIterator: Sendable { }

Sources/AsyncAlgorithms/AsyncCompactedSequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,3 @@ extension AsyncSequence {
6969
}
7070

7171
extension AsyncCompactedSequence: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }
72-
extension AsyncCompactedSequence.Iterator: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }

Sources/AsyncAlgorithms/AsyncExclusiveReductionsSequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,3 @@ extension AsyncExclusiveReductionsSequence: AsyncSequence {
112112
}
113113

114114
extension AsyncExclusiveReductionsSequence: Sendable where Base: Sendable, Element: Sendable { }
115-
extension AsyncExclusiveReductionsSequence.Iterator: Sendable where Base.AsyncIterator: Sendable, Element: Sendable { }

Sources/AsyncAlgorithms/AsyncInclusiveReductionsSequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@ extension AsyncInclusiveReductionsSequence: AsyncSequence {
8585
}
8686

8787
extension AsyncInclusiveReductionsSequence: Sendable where Base: Sendable { }
88-
extension AsyncInclusiveReductionsSequence.Iterator: Sendable where Base.AsyncIterator: Sendable, Base.Element: Sendable { }

Sources/AsyncAlgorithms/AsyncInterspersedSequence.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,3 @@ extension AsyncInterspersedSequence: AsyncSequence {
100100
}
101101

102102
extension AsyncInterspersedSequence: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }
103-
extension AsyncInterspersedSequence.Iterator: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }
104-
extension AsyncInterspersedSequence.Iterator.State: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }

Sources/AsyncAlgorithms/AsyncJoinedBySeparatorSequence.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,3 @@ public struct AsyncJoinedBySeparatorSequence<Base: AsyncSequence, Separator: Asy
142142

143143
extension AsyncJoinedBySeparatorSequence: Sendable
144144
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Separator: Sendable { }
145-
extension AsyncJoinedBySeparatorSequence.Iterator: Sendable
146-
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Base.AsyncIterator: Sendable, Separator: Sendable, Separator.AsyncIterator: Sendable, Base.Element.AsyncIterator: Sendable { }
147-
extension AsyncJoinedBySeparatorSequence.Iterator.State: Sendable
148-
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Base.AsyncIterator: Sendable, Separator: Sendable, Separator.AsyncIterator: Sendable, Base.Element.AsyncIterator: Sendable { }
149-
extension AsyncJoinedBySeparatorSequence.Iterator.State.SeparatorState: Sendable
150-
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Base.AsyncIterator: Sendable, Separator: Sendable, Separator.AsyncIterator: Sendable, Base.Element.AsyncIterator: Sendable { }

Sources/AsyncAlgorithms/AsyncJoinedSequence.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,3 @@ public struct AsyncJoinedSequence<Base: AsyncSequence>: AsyncSequence where Base
9292

9393
extension AsyncJoinedSequence: Sendable
9494
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Base.AsyncIterator: Sendable, Base.Element.AsyncIterator: Sendable { }
95-
extension AsyncJoinedSequence.Iterator: Sendable
96-
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Base.AsyncIterator: Sendable, Base.Element.AsyncIterator: Sendable { }
97-
extension AsyncJoinedSequence.Iterator.State: Sendable
98-
where Base: Sendable, Base.Element: Sendable, Base.Element.Element: Sendable, Base.AsyncIterator: Sendable, Base.Element.AsyncIterator: Sendable { }

Sources/AsyncAlgorithms/AsyncLazySequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,3 @@ public struct AsyncLazySequence<Base: Sequence>: AsyncSequence {
6767
}
6868

6969
extension AsyncLazySequence: Sendable where Base: Sendable { }
70-
extension AsyncLazySequence.Iterator: Sendable where Base.Iterator: Sendable { }

Sources/AsyncAlgorithms/AsyncRemoveDuplicatesSequence.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public struct AsyncRemoveDuplicatesSequence<Base: AsyncSequence>: AsyncSequence
8686
}
8787

8888
extension AsyncRemoveDuplicatesSequence: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }
89-
extension AsyncRemoveDuplicatesSequence.Iterator: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }
9089

9190

9291
/// An asynchronous sequence that omits repeated elements by testing them with an error-throwing predicate.
@@ -145,4 +144,3 @@ public struct AsyncThrowingRemoveDuplicatesSequence<Base: AsyncSequence>: AsyncS
145144
}
146145

147146
extension AsyncThrowingRemoveDuplicatesSequence: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }
148-
extension AsyncThrowingRemoveDuplicatesSequence.Iterator: Sendable where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable { }

Sources/AsyncAlgorithms/AsyncThrottleSequence.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,3 @@ extension AsyncThrottleSequence: AsyncSequence {
102102

103103
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
104104
extension AsyncThrottleSequence: Sendable where Base: Sendable, Element: Sendable { }
105-
106-
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
107-
extension AsyncThrottleSequence.Iterator: Sendable where Base.AsyncIterator: Sendable { }

Sources/AsyncAlgorithms/AsyncThrowingExclusiveReductionsSequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,3 @@ extension AsyncThrowingExclusiveReductionsSequence: AsyncSequence {
119119
}
120120

121121
extension AsyncThrowingExclusiveReductionsSequence: Sendable where Base: Sendable, Element: Sendable { }
122-
extension AsyncThrowingExclusiveReductionsSequence.Iterator: Sendable where Base.AsyncIterator: Sendable, Element: Sendable { }

Sources/AsyncAlgorithms/AsyncThrowingInclusiveReductionsSequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,3 @@ extension AsyncThrowingInclusiveReductionsSequence: AsyncSequence {
8989
}
9090

9191
extension AsyncThrowingInclusiveReductionsSequence: Sendable where Base: Sendable { }
92-
extension AsyncThrowingInclusiveReductionsSequence.Iterator: Sendable where Base.AsyncIterator: Sendable, Base.Element: Sendable { }

Sources/AsyncAlgorithms/AsyncTimerSequence.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,3 @@ extension AsyncTimerSequence where C == SuspendingClock {
8989

9090
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
9191
extension AsyncTimerSequence: Sendable { }
92-
93-
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
94-
extension AsyncTimerSequence.Iterator: Sendable { }

Tests/AsyncAlgorithmsTests/Support/GatedSequence.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ extension GatedSequence: AsyncSequence {
5252
}
5353

5454
extension GatedSequence: Sendable where Element: Sendable { }
55-
extension GatedSequence.Iterator: Sendable where Element: Sendable { }

0 commit comments

Comments
 (0)