Skip to content

Commit 065dbd0

Browse files
authored
Merge pull request #69533 from ktoso/pick-a3b4e90bb2598610ae89d807e6f89128ca4361eb
2 parents 3de51e3 + ee2f8c8 commit 065dbd0

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
@@ -6791,10 +6791,6 @@ WARNING(hashvalue_implementation,Deprecation,
67916791
"conform type %0 to 'Hashable' by implementing 'hash(into:)' instead",
67926792
(Type))
67936793

6794-
WARNING(executor_enqueue_deprecated_unowned_implementation,Deprecation,
6795-
"'Executor.enqueue(UnownedJob)' is deprecated as a protocol requirement; "
6796-
"conform type %0 to 'Executor' by implementing 'func enqueue(ExecutorJob)' instead",
6797-
(Type))
67986794
WARNING(executor_enqueue_deprecated_owned_job_implementation,Deprecation,
67996795
"'Executor.enqueue(Job)' is deprecated as a protocol requirement; "
68006796
"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
@@ -1451,14 +1451,10 @@ void swift::tryDiagnoseExecutorConformance(ASTContext &C,
14511451
}
14521452
}
14531453

1454-
// Old UnownedJob based impl is present, warn about it suggesting the new protocol requirement.
1455-
if (canRemoveOldDecls && unownedEnqueueWitnessDecl) {
1456-
if (!isStdlibDefaultImplDecl(unownedEnqueueWitnessDecl)) {
1457-
diags.diagnose(unownedEnqueueWitnessDecl->getLoc(),
1458-
diag::executor_enqueue_deprecated_unowned_implementation,
1459-
nominalTy);
1460-
}
1461-
}
1454+
// We specifically do allow the old UnownedJob implementation to be present.
1455+
// In order to ease migration and compatibility for libraries which remain compatible with old Swift versions,
1456+
// and would be getting this warning in situations they cannot address it.
1457+
14621458
// Old Job based impl is present, warn about it suggesting the new protocol requirement.
14631459
if (legacyMoveOnlyEnqueueWitnessDecl) {
14641460
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)