Skip to content

Commit df35da4

Browse files
authored
Merge pull request #64560 from kavon/revive-noncopyable-job
Ensure `#if $MoveOnly` feature guard evaluates to true.
2 parents 0a8f1f0 + 363448a commit df35da4

File tree

9 files changed

+18
-37
lines changed

9 files changed

+18
-37
lines changed

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ SUPPRESSIBLE_LANGUAGE_FEATURE(
9898
FreestandingExpressionMacros, 382, "Expression macros",
9999
true)
100100
LANGUAGE_FEATURE(AttachedMacros, 389, "Attached macros", true)
101+
LANGUAGE_FEATURE(MoveOnly, 390, "noncopyable types", true)
101102

102103
UPCOMING_FEATURE(ConciseMagicFile, 274, 6)
103104
UPCOMING_FEATURE(ForwardTrailingClosures, 286, 6)
@@ -108,7 +109,6 @@ EXPERIMENTAL_FEATURE(StaticAssert, false)
108109
EXPERIMENTAL_FEATURE(VariadicGenerics, false)
109110
EXPERIMENTAL_FEATURE(NamedOpaqueTypes, false)
110111
EXPERIMENTAL_FEATURE(FlowSensitiveConcurrencyCaptures, false)
111-
EXPERIMENTAL_FEATURE(MoveOnly, true)
112112
EXPERIMENTAL_FEATURE(FreestandingMacros, true)
113113

114114
// FIXME: MoveOnlyClasses is not intended to be in production,

stdlib/public/Concurrency/PartialAsyncTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ extension UnownedJob: CustomStringConvertible {
111111
/// you don't generally interact with jobs directly.
112112
@available(SwiftStdlib 5.9, *)
113113
@frozen
114-
// @_moveOnly // FIXME(moveonly): rdar://107050387 Move-only types fail to be found sometimes, must fix or remove Job before shipping
114+
@_moveOnly
115115
public struct Job: Sendable {
116116
internal var context: Builtin.Job
117117

test/Concurrency/Runtime/custom_executors_moveOnly_job.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// REQUIRES: concurrency
44
// REQUIRES: executable_test
55

6-
// FIXME(moveonly): rdar://106849189 move-only types should be supported in freestanding mode
6+
// rdar://106849189 move-only types should be supported in freestanding mode
77
// UNSUPPORTED: freestanding
88

99
// FIXME: rdar://107112715 test failing on iOS simulator, investigating
@@ -13,11 +13,7 @@
1313
// REQUIRES: concurrency_runtime
1414

1515
final class InlineExecutor: SerialExecutor, CustomStringConvertible {
16-
// FIXME(moveonly): rdar://107050387 Move-only types fail to be found sometimes, must fix or remove Job before shipping
17-
// public func enqueue(_ job: __owned Job) {
18-
// job.runSynchronously(on: self.asUnownedSerialExecutor())
19-
// }
20-
public func enqueue(_ job: UnownedJob) {
16+
public func enqueue(_ job: __owned Job) {
2117
job.runSynchronously(on: self.asUnownedSerialExecutor())
2218
}
2319

test/Concurrency/Runtime/custom_executors_priority.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@
1313
// REQUIRES: concurrency_runtime
1414

1515
final class InlineExecutor: SerialExecutor {
16-
// FIXME(moveonly): rdar://107050387 Move-only types fail to be found sometimes, must fix or remove Job before shipping
17-
// public func enqueue(_ job: __owned Job) {
18-
// print("\(self): enqueue (priority: \(TaskPriority(job.priority)!))")
19-
// job.runSynchronously(on: self.asUnownedSerialExecutor())
20-
// }
21-
public func enqueue(_ job: UnownedJob) {
16+
public func enqueue(_ job: __owned Job) {
2217
print("\(self): enqueue (priority: \(TaskPriority(job.priority)!))")
2318
job.runSynchronously(on: self.asUnownedSerialExecutor())
2419
}

test/Concurrency/Runtime/custom_executors_protocol.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,9 @@ final class NaiveQueueExecutor: SpecifiedExecutor, CustomStringConvertible {
3838
self.queue = queue
3939
}
4040

41-
// FIXME(moveonly): rdar://107050387 Move-only types fail to be found sometimes, must fix or remove Job before shipping
42-
// public func enqueue(_ job: __owned Job) {
43-
// print("\(self): enqueue")
44-
// let unowned = UnownedJob(job)
45-
// queue.sync {
46-
// unowned.runSynchronously(on: self.asUnownedSerialExecutor())
47-
// }
48-
// print("\(self): after run")
49-
// }
50-
public func enqueue(_ unowned: UnownedJob) {
41+
public func enqueue(_ job: __owned Job) {
5142
print("\(self): enqueue")
43+
let unowned = UnownedJob(job)
5244
queue.sync {
5345
unowned.runSynchronously(on: self.asUnownedSerialExecutor())
5446
}

test/Concurrency/custom_executor_enqueue_impls.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-move-only -disable-availability-checking
22
// REQUIRES: concurrency
33

4-
// FIXME(moveonly): rdar://106849189 move-only types should be supported in freestanding mode
4+
// rdar://106849189 move-only types should be supported in freestanding mode
55
// UNSUPPORTED: freestanding
66

7-
// FIXME(moveonly): rdar://107050387 Move-only types fail to be found sometimes, must fix or remove Job before shipping
8-
// REQUIRES: radr107050387
9-
107
// FIXME: rdar://107112715 test failing on iOS simulator, investigating
118
// UNSUPPORTED: OS=ios
129

test/IRGen/async/builtin_executor.sil

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
// RUN: %target-swift-frontend -primary-file %s -module-name=test -disable-llvm-optzns -disable-swift-specific-llvm-optzns -emit-ir -sil-verify-all | %IRGenFileCheck %s
22

33
// REQUIRES: concurrency
4-
// FIXME(moveonly): rdar://106849189 move-only types should be supported in freestanding mode
4+
// rdar://106849189 move-only types should be supported in freestanding mode
55
// UNSUPPORTED: freestanding
66

7-
// FIXME(moveonly): rdar://107050387 Move-only types fail to be found sometimes, must fix or remove Job before shipping
8-
// REQUIRES: radr107050387
9-
107
sil_stage canonical
118

129
import Builtin

test/ModuleInterface/moveonly_interface_flag.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -enable-experimental-feature MoveOnly
2+
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library
33
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t
44
// RUN: %FileCheck %s < %t/Library.swiftinterface
55

66
// this test makes sure that decls containing a move-only type are guarded by the $MoveOnly feature flag
77

8-
// CHECK: swift-module-flags-ignorable: -enable-experimental-feature MoveOnly
9-
108
// CHECK: #if compiler(>=5.3) && $MoveOnly
119
// CHECK-NEXT: @_moveOnly public struct MoveOnlyStruct {
1210

@@ -40,5 +38,3 @@ public class What {
4038
public extension MoveOnlyStruct {
4139
func who() {}
4240
}
43-
44-

test/Sema/moveonly_experimental.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ func checkNoImplicitCopy2(_ x: SomeValue) {
3131
checkNoImplicitCopy2(y)
3232
}
3333

34+
// coverage to ensure the feature flag is working
35+
#if $MoveOnly
36+
func guardedFn() {}
37+
#endif
38+
39+
func caller() {
40+
guardedFn()
41+
}
3442

3543

3644

0 commit comments

Comments
 (0)