mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Mark SerialExecutor.asUnownedSerialExecutor unsafe so conformances don't need to be @unsafe
What we should actually do with SerialExecutor conformances is not yet clear, though.
This commit is contained in:
@@ -144,6 +144,7 @@ public protocol SerialExecutor: Executor {
|
|||||||
|
|
||||||
/// Convert this executor value to the optimized form of borrowed
|
/// Convert this executor value to the optimized form of borrowed
|
||||||
/// executor references.
|
/// executor references.
|
||||||
|
@unsafe
|
||||||
func asUnownedSerialExecutor() -> UnownedSerialExecutor
|
func asUnownedSerialExecutor() -> UnownedSerialExecutor
|
||||||
|
|
||||||
/// If this executor has complex equality semantics, and the runtime needs to
|
/// If this executor has complex equality semantics, and the runtime needs to
|
||||||
|
|||||||
@@ -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}}
|
// expected-warning@+1{{type alias 'WeirdC' involves unsafe code; use '@unsafe' to indicate that its use is not memory-safe}}
|
||||||
typealias WeirdC = RequiresSendable<C> // expected-note{{@unchecked conformance of 'C' to protocol 'Sendable' involves unsafe code}}
|
typealias WeirdC = RequiresSendable<C> // 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") }
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user