Skip to content

Commit a315cca

Browse files
authored
Merge pull request #69532 from ktoso/wip-un-deprecate-enqueue-unownedjob
2 parents e19954f + a3b4e90 commit a315cca

File tree

6 files changed

+10
-19
lines changed

6 files changed

+10
-19
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6935,10 +6935,6 @@ WARNING(hashvalue_implementation,Deprecation,
69356935
"conform type %0 to 'Hashable' by implementing 'hash(into:)' instead",
69366936
(Type))
69376937

6938-
WARNING(executor_enqueue_deprecated_unowned_implementation,Deprecation,
6939-
"'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; "
6940-
"conform type %0 to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead",
6941-
(Type))
69426938
WARNING(executor_enqueue_deprecated_owned_job_implementation,Deprecation,
69436939
"'Executor.enqueue(Job)' is deprecated as a protocol requirement; "
69446940
"conform type %0 to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead",

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,14 +1459,10 @@ void swift::tryDiagnoseExecutorConformance(ASTContext &C,
14591459
}
14601460
}
14611461

1462-
// Old UnownedJob based impl is present, warn about it suggesting the new protocol requirement.
1463-
if (canRemoveOldDecls && unownedEnqueueWitnessDecl) {
1464-
if (!isStdlibDefaultImplDecl(unownedEnqueueWitnessDecl)) {
1465-
diags.diagnose(unownedEnqueueWitnessDecl->getLoc(),
1466-
diag::executor_enqueue_deprecated_unowned_implementation,
1467-
nominalTy);
1468-
}
1469-
}
1462+
// We specifically do allow the old UnownedJob implementation to be present.
1463+
// In order to ease migration and compatibility for libraries which remain compatible with old Swift versions,
1464+
// and would be getting this warning in situations they cannot address it.
1465+
14701466
// Old Job based impl is present, warn about it suggesting the new protocol requirement.
14711467
if (legacyMoveOnlyEnqueueWitnessDecl) {
14721468
if (!isStdlibDefaultImplDecl(legacyMoveOnlyEnqueueWitnessDecl)) {

stdlib/public/Concurrency/Executor.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public protocol Executor: AnyObject, Sendable {
2020
// Do not deprecate the UnownedJob enqueue in that configuration just yet - as we cannot introduce the replacements.
2121
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
2222
@available(SwiftStdlib 5.1, *)
23-
@available(*, deprecated, message: "Implement 'enqueue(_: __owned ExecutorJob)' instead")
2423
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
2524
func enqueue(_ job: UnownedJob)
2625

test/Concurrency/custom_executor_enqueue_availability.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ final class BothExecutorOldStdlib: SerialExecutor {
4040
/// that it can be dropped.
4141
@available(SwiftStdlib 5.9, *)
4242
final class BothExecutorNewStdlib: SerialExecutor {
43-
func enqueue(_ job: UnownedJob) {} // expected-warning{{'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; conform type 'BothExecutorNewStdlib' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
43+
func enqueue(_ job: UnownedJob) {} // no warning, we're not deprecating the UnownedJob enqueue method yet
4444

4545
func enqueue(_ job: __owned ExecutorJob) {}
4646

@@ -51,7 +51,7 @@ final class BothExecutorNewStdlib: SerialExecutor {
5151

5252
@available(SwiftStdlib 5.9, *)
5353
final class TripleExecutor: SerialExecutor {
54-
func enqueue(_ job: UnownedJob) {} // expected-warning{{'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; conform type 'TripleExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
54+
func enqueue(_ job: UnownedJob) {} // no warning, we're not deprecating the UnownedJob enqueue method yet
5555

5656
// expected-warning@+2{{'Job' is deprecated: renamed to 'ExecutorJob'}}
5757
// expected-note@+1{{use 'ExecutorJob' instead}}

test/Concurrency/custom_executor_enqueue_deprecation_on_executor_extension.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
extension Executor {
14-
func enqueue(_ job: UnownedJob) { // expected-warning{{'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; conform type 'NoneExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
14+
func enqueue(_ job: UnownedJob) { // no warning, we don't deprecate this just yet. It was deprecated in 5.9.0 but we undid this.
1515
fatalError()
1616
}
1717
}

test/Concurrency/custom_executor_enqueue_impls.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//
1515
// We keep support for them, but also log a deprecation warning that they should move to the new signature.
1616
final class OldExecutor: SerialExecutor {
17-
func enqueue(_ job: UnownedJob) {} // expected-warning{{'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; conform type 'OldExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
17+
func enqueue(_ job: UnownedJob) {} // no warning, we're not deprecating the UnownedJob enqueue method yet
1818

1919
func asUnownedSerialExecutor() -> UnownedSerialExecutor {
2020
UnownedSerialExecutor(ordinary: self)
@@ -26,7 +26,7 @@ final class OldExecutor: SerialExecutor {
2626
///
2727
/// That's why we do log the deprecation warning, people should use the move-only version.
2828
final class BothExecutor: SerialExecutor {
29-
func enqueue(_ job: UnownedJob) {} // expected-warning{{'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; conform type 'BothExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
29+
func enqueue(_ job: UnownedJob) {} // no warning, we're not deprecating the UnownedJob enqueue method yet
3030

3131
func enqueue(_ job: __owned ExecutorJob) {}
3232

@@ -37,7 +37,7 @@ final class BothExecutor: SerialExecutor {
3737

3838
/// For now we must keep all 3 implementation kinds and warn about deprecated ones
3939
final class TripleExecutor: SerialExecutor {
40-
func enqueue(_ job: UnownedJob) {} // expected-warning{{'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; conform type 'TripleExecutor' to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead}}
40+
func enqueue(_ job: UnownedJob) {} // no warning, we're not deprecating the UnownedJob enqueue method yet
4141

4242
// expected-warning@+2{{'Job' is deprecated: renamed to 'ExecutorJob'}}
4343
// expected-note@+1{{use 'ExecutorJob' instead}}

0 commit comments

Comments
 (0)