Skip to content

Commit 111b78e

Browse files
committed
Add @_implicitSelfCapture to asyncDetached.
Like `async`, `asyncDetached` should not require `self.` because it is unlikely to introduce cycles. (cherry picked from commit 2000bf9)
1 parent 68876ac commit 111b78e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/Concurrency/Task.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ public func detach<T>(
489489
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
490490
public func asyncDetached<T>(
491491
priority: Task.Priority = .unspecified,
492-
operation: __owned @Sendable @escaping () async -> T
492+
@_implicitSelfCapture operation: __owned @Sendable @escaping () async -> T
493493
) -> Task.Handle<T, Never> {
494494
return detach(priority: priority, operation: operation)
495495
}
@@ -499,7 +499,7 @@ public func asyncDetached<T>(
499499
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
500500
public func asyncDetached<T>(
501501
priority: Task.Priority = .unspecified,
502-
operation: __owned @Sendable @escaping () async throws -> T
502+
@_implicitSelfCapture operation: __owned @Sendable @escaping () async throws -> T
503503
) -> Task.Handle<T, Error> {
504504
return detach(priority: priority, operation: operation)
505505
}

0 commit comments

Comments
 (0)