Skip to content

Commit 4a63884

Browse files
committed
Add missing Sendable requirements and a conformance
1 parent 0ace8fe commit 4a63884

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

stdlib/public/Concurrency/AsyncStreamBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ extension AsyncThrowingStream {
543543
}
544544

545545
// this is used to store closures; which are two words
546-
final class _AsyncStreamCriticalStorage<Contents> {
546+
final class _AsyncStreamCriticalStorage<Contents>: UnsafeSendable {
547547
var _value: Contents
548548
private init(_doNotCallMe: ()) {
549549
fatalError("_AsyncStreamCriticalStorage must be initialized by create")

stdlib/public/Concurrency/MainActor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import Swift
4545
@available(SwiftStdlib 5.5, *)
4646
extension MainActor {
4747
/// Execute the given body closure on the main actor.
48-
public static func run<T>(
48+
public static func run<T: Sendable>(
4949
resultType: T.Type = T.self,
5050
body: @MainActor @Sendable () throws -> T
5151
) async rethrows -> T {

stdlib/public/Concurrency/SourceCompatibilityShims.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ public func async<T>(
155155
@available(SwiftStdlib 5.5, *)
156156
extension Task where Success == Never, Failure == Never {
157157
@available(*, deprecated, message: "`Task.Group` was replaced by `ThrowingTaskGroup` and `TaskGroup` and will be removed shortly.")
158-
public typealias Group<TaskResult> = ThrowingTaskGroup<TaskResult, Error>
158+
public typealias Group<TaskResult: Sendable> = ThrowingTaskGroup<TaskResult, Error>
159159

160160
@available(*, deprecated, message: "`Task.withGroup` was replaced by `withThrowingTaskGroup` and `withTaskGroup` and will be removed shortly.")
161161
@_alwaysEmitIntoClient
162-
public static func withGroup<TaskResult, BodyResult>(
162+
public static func withGroup<TaskResult: Sendable, BodyResult>(
163163
resultType: TaskResult.Type,
164164
returning returnType: BodyResult.Type = BodyResult.self,
165165
body: (inout Task.Group<TaskResult>) async throws -> BodyResult

stdlib/public/Concurrency/Task.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ func _enqueueJobGlobalWithDelay(_ delay: UInt64, _ task: Builtin.Job)
756756
public func _asyncMainDrainQueue() -> Never
757757

758758
@available(SwiftStdlib 5.5, *)
759-
public func _runAsyncMain(_ asyncFun: @escaping () async throws -> ()) {
759+
public func _runAsyncMain(@_unsafeSendable _ asyncFun: @escaping () async throws -> ()) {
760760
Task.detached {
761761
do {
762762
#if !os(Windows)

0 commit comments

Comments
 (0)