Skip to content

Commit 29cffc7

Browse files
committed
docs update
1 parent d623460 commit 29cffc7

File tree

6 files changed

+25
-22
lines changed

6 files changed

+25
-22
lines changed

stdlib/public/Concurrency/Executor.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public protocol Executor: AnyObject, Sendable {
2929
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
3030
@available(SwiftStdlib 5.9, *)
3131
@available(*, deprecated, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
32-
func enqueue(_ job: __owned Job)
32+
func enqueue(_ job: consuming Job)
3333
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
3434

3535
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@@ -60,7 +60,7 @@ public protocol SerialExecutor: Executor {
6060
@_nonoverride
6161
@available(SwiftStdlib 5.9, *)
6262
@available(*, deprecated, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
63-
func enqueue(_ job: consuming ExecutorJob)
63+
func enqueue(_ job: consuming Job) // must remain '__owned' in order to not break ABI
6464
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
6565

6666
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
@@ -70,7 +70,7 @@ public protocol SerialExecutor: Executor {
7070
// work-scheduling operation.
7171
@_nonoverride
7272
@available(SwiftStdlib 5.9, *)
73-
func enqueue(_ job: __owned ExecutorJob)
73+
func enqueue(_ job: consuming ExecutorJob)
7474
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
7575

7676
/// Convert this executor value to the optimized form of borrowed
@@ -114,7 +114,7 @@ extension Executor {
114114
self.enqueue(Job(job))
115115
}
116116

117-
public func enqueue(_ job: __owned Job) {
117+
public func enqueue(_ job: consuming Job) {
118118
self.enqueue(UnownedJob(job))
119119
}
120120
}

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ public struct UnownedJob: Sendable {
4545
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
4646
/// Create an `UnownedJob` whose lifetime must be managed carefully until it is run exactly once.
4747
@available(SwiftStdlib 5.9, *)
48-
public init(_ job: __owned ExecutorJob) { // must remain '__owned' in order to not break ABI
48+
public init(_ job: __owned Job) { // must remain '__owned' in order to not break ABI
4949
self.context = job.context
5050
}
5151
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
5252

5353
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
5454
/// Create an `UnownedJob` whose lifetime must be managed carefully until it is run exactly once.
5555
@available(SwiftStdlib 5.9, *)
56-
public init(_ job: __owned ExecutorJob) {
56+
public init(_ job: __owned ExecutorJob) { // must remain '__owned' in order to not break ABI
5757
self.context = job.context
5858
}
5959
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

test/Concurrency/Runtime/custom_executors_moveOnly_job.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@
99
// UNSUPPORTED: back_deployment_runtime
1010
// REQUIRES: concurrency_runtime
1111

12-
final class InlineExecutor: SerialExecutor, CustomStringConvertible {
13-
public func enqueue(_ job: consuming ExecutorJob) {
12+
@available(*, deprecated, message: "Test type to verify deprecated API still works")
13+
final class InlineExecutor_UnownedJob: SerialExecutor, CustomStringConvertible {
14+
public func enqueue(_ job: UnownedJob) {
1415
job.runSynchronously(on: self.asUnownedSerialExecutor())
1516
}
1617

1718
var description: Swift.String {
1819
"\(Self.self)()"
1920
}
2021
}
22+
23+
@available(*, deprecated, message: "Test type to verify deprecated API still works")
2124
final class InlineExecutor_Job: SerialExecutor, CustomStringConvertible {
2225
public func enqueue(_ job: __owned Job) {
2326
job.runSynchronously(on: self.asUnownedSerialExecutor())

test/Inputs/clang-importer-sdk/swift-modules-concurrency-consuming-job-param/_Concurrency.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
// This simulates a pre-Swift5.9 concurrency library with `Job` and `ExecutorJob` not being defined at all.
3-
// This is used to verify missing type handling in the SDK when a latest compiler is used.
2+
// This simulates a pre-Swift5.9 concurrency library with an consuming declaration rather than __owned.
3+
// This allows us to confirm the compiler and sdk can be mismatched but we'll build correctly.
44

55
@_moveOnly
66
public struct ExecutorJob {}

test/Inputs/clang-importer-sdk/swift-modules-concurrency-owned-job-param/_Concurrency.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

2-
// This simulates a pre-Swift5.9 concurrency library with `Job` and `ExecutorJob` not being defined at all.
3-
// This is used to verify missing type handling in the SDK when a latest compiler is used.
2+
// This simulates a pre-Swift5.9 concurrency library with an __owned declaration rather than consuming.
3+
// This allows us to confirm the compiler and sdk can be mismatched but we'll build correctly.
44

55
@_moveOnly
66
public struct ExecutorJob {}

test/lit.cfg

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -624,16 +624,6 @@ config.substitutions.append(('%clang-importer-sdk-concurrency-without-job',
624624
'-enable-source-import -sdk %r -I %r ' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'),
625625
make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk', 'swift-modules-concurrency-without-job'))))
626626

627-
# FIXME: BEGIN -enable-source-import hackaround
628-
config.substitutions.append(('%clang-importer-sdk-concurrency-owned-job-param-path',
629-
'%r' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'))))
630-
config.substitutions.append(('%clang-importer-sdk-concurrency-owned-job-param-nosource',
631-
'-sdk %r' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'))))
632-
# FIXME: END -enable-source-import hackaround
633-
config.substitutions.append(('%clang-importer-sdk-concurrency-owned-job-param',
634-
'-enable-source-import -sdk %r -I %r ' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'),
635-
make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk', 'swift-modules-concurrency-owned-job-param'))))
636-
637627
# FIXME: BEGIN -enable-source-import hackaround
638628
config.substitutions.append(('%clang-importer-sdk-concurrency-typealias-struct-job-path',
639629
'%r' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'))))
@@ -654,6 +644,16 @@ config.substitutions.append(('%clang-importer-sdk-concurrency-consuming-job-para
654644
'-enable-source-import -sdk %r -I %r ' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'),
655645
make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk', 'swift-modules-concurrency-consuming-job-param'))))
656646

647+
# FIXME: BEGIN -enable-source-import hackaround
648+
config.substitutions.append(('%clang-importer-sdk-concurrency-owned-job-param-path',
649+
'%r' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'))))
650+
config.substitutions.append(('%clang-importer-sdk-concurrency-owned-job-param-nosource',
651+
'-sdk %r' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'))))
652+
# FIXME: END -enable-source-import hackaround
653+
config.substitutions.append(('%clang-importer-sdk-concurrency-owned-job-param',
654+
'-enable-source-import -sdk %r -I %r ' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'),
655+
make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk', 'swift-modules-concurrency-owned-job-param'))))
656+
657657
# FIXME: BEGIN -enable-source-import hackaround
658658
config.substitutions.append(('%clang-importer-sdk-path',
659659
'%r' % (make_path(config.test_source_root, 'Inputs', 'clang-importer-sdk'))))

0 commit comments

Comments
 (0)