diff --git a/stdlib/public/Concurrency/Executor.swift b/stdlib/public/Concurrency/Executor.swift index da6356eb8e9..be4e46c95d9 100644 --- a/stdlib/public/Concurrency/Executor.swift +++ b/stdlib/public/Concurrency/Executor.swift @@ -144,6 +144,7 @@ public protocol SerialExecutor: Executor { /// Convert this executor value to the optimized form of borrowed /// executor references. + @unsafe func asUnownedSerialExecutor() -> UnownedSerialExecutor /// If this executor has complex equality semantics, and the runtime needs to diff --git a/test/Unsafe/unsafe_concurrency.swift b/test/Unsafe/unsafe_concurrency.swift index e3a9827c077..93cbeb0b1c0 100644 --- a/test/Unsafe/unsafe_concurrency.swift +++ b/test/Unsafe/unsafe_concurrency.swift @@ -37,3 +37,10 @@ func f() async { // expected-warning{{global function 'f' involves unsafe code; // expected-warning@+1{{type alias 'WeirdC' involves unsafe code; use '@unsafe' to indicate that its use is not memory-safe}} typealias WeirdC = RequiresSendable // expected-note{{@unchecked conformance of 'C' to protocol 'Sendable' involves unsafe code}} + + +@available(SwiftStdlib 5.9, *) +final class MyExecutor: SerialExecutor { + func enqueue(_ job: consuming ExecutorJob) { fatalError("boom") } + @unsafe func asUnownedSerialExecutor() -> UnownedSerialExecutor { fatalError("boom") } +}