Avatar
Avatar
Iceman
@swift-5.5.3 import Foundation class C {} _ = AsyncStream(String.self) { continuation in let c = C() continuation.onTermination = { print("\(c)") } } _ = AsyncStream(String.self) { continuation in let c = C() let cushion: @Sendable (AsyncStream<String>.Continuation.Termination) -> Void = { _ in print("\(c)") } continuation.onTermination = cushion } (edited)
exit status: 1 with stderr:<stdin>:7:30: error: converting non-concurrent function value to '@Sendable (AsyncStream<String>.Continuation.Termination) -> Void' may introduce data races continuation.onTermination = { ^ (edited)