Skip to content

Commit fd027ae

Browse files
authored
Merge pull request #65793 from ktoso/pick-wip-better-deprecation-of-jobs
🍒[5.9][Concurrency] Easier to handle deprecation of Job and friends
2 parents 9c997ce + 588447b commit fd027ae

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

stdlib/public/Concurrency/Executor.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ import Swift
1616
@available(SwiftStdlib 5.1, *)
1717
public protocol Executor: AnyObject, Sendable {
1818

19+
// Since lack move-only type support in the SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY configuration
20+
// Do not deprecate the UnownedJob enqueue in that configuration just yet - as we cannot introduce the replacements.
1921
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
20-
@available(macOS, introduced: 10.15, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
21-
@available(iOS, introduced: 13.0, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
22-
@available(watchOS, introduced: 6.0, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
23-
@available(tvOS, introduced: 13.0, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
22+
@available(SwiftStdlib 5.1, *)
23+
@available(*, deprecated, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
2424
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
2525
func enqueue(_ job: UnownedJob)
2626

27+
// Cannot introduce these methods in SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
28+
// since it lacks move-only type support.
2729
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
28-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
29-
@available(*, deprecated, message: "Use enqueue(ExecutorJob) instead")
30+
@available(SwiftStdlib 5.9, *)
31+
@available(*, deprecated, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
3032
func enqueue(_ job: __owned Job)
3133
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
3234

@@ -45,10 +47,8 @@ public protocol SerialExecutor: Executor {
4547
// work-scheduling operation.
4648
@_nonoverride
4749
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
48-
@available(macOS, introduced: 10.15, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
49-
@available(iOS, introduced: 13.0, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
50-
@available(watchOS, introduced: 6.0, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
51-
@available(tvOS, introduced: 13.0, deprecated: 9999, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
50+
@available(SwiftStdlib 5.1, *)
51+
@available(*, deprecated, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
5252
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
5353
func enqueue(_ job: UnownedJob)
5454

@@ -58,8 +58,8 @@ public protocol SerialExecutor: Executor {
5858
// avoid drilling down to the base conformance just for the basic
5959
// work-scheduling operation.
6060
@_nonoverride
61-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
62-
@available(*, deprecated, message: "Use enqueue(ExecutorJob) instead")
61+
@available(SwiftStdlib 5.9, *)
62+
@available(*, deprecated, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
6363
func enqueue(_ job: __owned Job)
6464
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
6565

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ extension UnownedJob: CustomStringConvertible {
120120
///
121121
/// Unless you're implementing a scheduler,
122122
/// you don't generally interact with jobs directly.
123-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
123+
@available(SwiftStdlib 5.9, *)
124124
@available(*, deprecated, renamed: "ExecutorJob")
125125
@frozen
126126
@_moveOnly

0 commit comments

Comments
 (0)