Skip to content

Commit 8abc335

Browse files
committed
remove sendable base iterator constraint
1 parent c036b80 commit 8abc335

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/AsyncAlgorithms/AsyncSharedSequence.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import DequeModule
1313

14-
extension AsyncSequence {
14+
extension AsyncSequence where Self: Sendable, Element: Sendable {
1515

1616
/// Creates an asynchronous sequence that can be shared by multiple consumers.
1717
///
@@ -54,7 +54,7 @@ extension AsyncSequence {
5454
/// iterator when the connected consumer count falls to zero, its history will be discarded at the
5555
/// same time.
5656
public struct AsyncSharedSequence<Base: AsyncSequence>
57-
where Base: Sendable, Base.Element: Sendable, Base.AsyncIterator: Sendable {
57+
where Base: Sendable, Base.Element: Sendable {
5858

5959
/// The iterator disposal policy applied by a shared asynchronous sequence to its upstream iterator
6060
///
@@ -97,7 +97,7 @@ extension AsyncSharedSequence: AsyncSequence, Sendable {
9797

9898
public typealias Element = Base.Element
9999

100-
public struct Iterator: AsyncIteratorProtocol, Sendable {
100+
public struct Iterator: AsyncIteratorProtocol, Sendable where Base.Element: Sendable {
101101

102102
private let id: UInt
103103
private let deallocToken: DeallocToken?
@@ -194,9 +194,9 @@ fileprivate extension AsyncSharedSequence {
194194
deinit { action() }
195195
}
196196

197-
struct SharedUpstreamIterator {
197+
struct SharedUpstreamIterator: Sendable {
198198

199-
private enum State {
199+
private enum State: @unchecked Sendable {
200200
case pending
201201
case active(Base.AsyncIterator)
202202
case terminal
@@ -207,7 +207,7 @@ fileprivate extension AsyncSharedSequence {
207207
return true
208208
}
209209

210-
private let createIterator: () -> Base.AsyncIterator
210+
private let createIterator: @Sendable () -> Base.AsyncIterator
211211
private var state = State.pending
212212

213213
init(_ createIterator: @escaping @Sendable () -> Base.AsyncIterator) {

0 commit comments

Comments
 (0)