From 510d70be1eec2f404f1cf658da8528042499f1c6 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Sun, 4 Oct 2026 09:31:56 +1100 Subject: [PATCH] Declare AnyAsyncSequence Sendable when its elements are The type holds nothing but a @Sendable closure, and the base it erases is itself Sendable, but without the conformance an erased sequence can neither leave an actor nor be merged with another and erased again under the Swift 6 language mode. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01T8cahEd4GfsHQ89sNrmP4p --- Sources/Operators/AsyncSequence+EraseToAnyAsyncSequence.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/Operators/AsyncSequence+EraseToAnyAsyncSequence.swift b/Sources/Operators/AsyncSequence+EraseToAnyAsyncSequence.swift index 6626da6..d4958c1 100644 --- a/Sources/Operators/AsyncSequence+EraseToAnyAsyncSequence.swift +++ b/Sources/Operators/AsyncSequence+EraseToAnyAsyncSequence.swift @@ -28,6 +28,10 @@ public struct AnyAsyncSequence: AsyncSequence { } } +/// An `AnyAsyncSequence` holds nothing but a `@Sendable` closure, and the base it erases is +/// itself `Sendable`, so it is safe to send when its elements are. +extension AnyAsyncSequence: @unchecked Sendable where Element: Sendable {} + public struct AnyAsyncIterator: AsyncIteratorProtocol { public typealias Element = Element