Skip to content

Commit b28efc5

Browse files
authored
Merge pull request #61117 from apple/revert-60790-rdar99047747
Revert "[Freestanding] Disable checked continuations."
2 parents c4c48c0 + 9a7c0b9 commit b28efc5

File tree

2 files changed

+0
-71
lines changed

2 files changed

+0
-71
lines changed

stdlib/public/Concurrency/CheckedContinuation.swift

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import Swift
1616
@_silgen_name("swift_continuation_logFailedCheck")
1717
internal func logFailedCheck(_ message: UnsafeRawPointer)
1818

19-
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
2019
/// Implementation class that holds the `UnsafeContinuation` instance for
2120
/// a `CheckedContinuation`.
2221
@available(SwiftStdlib 5.1, *)
@@ -83,9 +82,7 @@ internal final class CheckedContinuationCanary: @unchecked Sendable {
8382
}
8483
}
8584
}
86-
#endif
8785

88-
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
8986
/// A mechanism to interface
9087
/// between synchronous and asynchronous code,
9188
/// logging correctness violations.
@@ -299,65 +296,4 @@ public func withCheckedThrowingContinuation<T>(
299296
body(CheckedContinuation(continuation: $0, function: function))
300297
}
301298
}
302-
#else
303-
@available(SwiftStdlib 5.1, *)
304-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
305-
public struct CheckedContinuation<T, E: Error>: Sendable {
306-
@available(SwiftStdlib 5.1, *)
307-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
308-
public init(continuation: UnsafeContinuation<T, E>, function: String = #function) {
309-
fatalError("Unavailable in task-to-thread concurrency model")
310-
}
311-
312-
@available(SwiftStdlib 5.1, *)
313-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
314-
public func resume(returning value: __owned T) {
315-
fatalError("Unavailable in task-to-thread concurrency model")
316-
}
317-
318-
@available(SwiftStdlib 5.1, *)
319-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
320-
public func resume(throwing error: __owned E) {
321-
fatalError("Unavailable in task-to-thread concurrency model")
322-
}
323-
}
324-
@available(SwiftStdlib 5.1, *)
325-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
326-
extension CheckedContinuation {
327-
@available(SwiftStdlib 5.1, *)
328-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
329-
public func resume<Er: Error>(with result: Result<T, Er>) where E == Error {
330-
fatalError("Unavailable in task-to-thread concurrency model")
331-
}
332-
333-
@available(SwiftStdlib 5.1, *)
334-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
335-
public func resume(with result: Result<T, E>) {
336-
fatalError("Unavailable in task-to-thread concurrency model")
337-
}
338299

339-
@available(SwiftStdlib 5.1, *)
340-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
341-
public func resume() where T == Void {
342-
fatalError("Unavailable in task-to-thread concurrency model")
343-
}
344-
}
345-
346-
@available(SwiftStdlib 5.1, *)
347-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
348-
public func withCheckedContinuation<T>(
349-
function: String = #function,
350-
_ body: (CheckedContinuation<T, Never>) -> Void
351-
) async -> T {
352-
fatalError("Unavailable in task-to-thread concurrency model")
353-
}
354-
355-
@available(SwiftStdlib 5.1, *)
356-
@available(*, unavailable, message: "Unavailable in task-to-thread concurrency model")
357-
public func withCheckedThrowingContinuation<T>(
358-
function: String = #function,
359-
_ body: (CheckedContinuation<T, Error>) -> Void
360-
) async throws -> T {
361-
fatalError("Unavailable in task-to-thread concurrency model")
362-
}
363-
#endif

test/stdlib/freestanding_diags_stdlib.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ func foo() async {
2424
asyncDetached { () async -> () in } // expected-error{{Unavailable in task-to-thread concurrency model}}
2525
asyncDetached { () async throws -> () in } // expected-error{{Unavailable in task-to-thread concurrency model}}
2626
_ = MainActor.self // expected-error{{Unavailable in task-to-thread concurrency model}}
27-
let _: Int = await withCheckedContinuation { _ in } // expected-error{{Unavailable in task-to-thread concurrency model}}
28-
do {
29-
let _: Int = try await withCheckedThrowingContinuation { _ in } // expected-error{{Unavailable in task-to-thread concurrency model}}
30-
} catch let error {
31-
_ = error
32-
}
33-
_ = CheckedContinuation<Int, Never>.self // expected-error{{Unavailable in task-to-thread concurrency model}}
3427
}
3528

3629
func foo2(

0 commit comments

Comments
 (0)