Skip to content

Commit 353daab

Browse files
committed
Replace UnsafeSendable with @unchecked Sendable in the standard library.
1 parent ffd435d commit 353daab

13 files changed

+24
-24
lines changed

stdlib/public/Concurrency/AsyncStreamBuffer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func _unlock(_ ptr: UnsafeRawPointer)
5353

5454
@available(SwiftStdlib 5.1, *)
5555
extension AsyncStream {
56-
internal final class _Storage: UnsafeSendable {
56+
internal final class _Storage: @unchecked Sendable {
5757
typealias TerminationHandler = @Sendable (Continuation.Termination) -> Void
5858

5959
struct State {
@@ -285,7 +285,7 @@ extension AsyncStream {
285285

286286
@available(SwiftStdlib 5.1, *)
287287
extension AsyncThrowingStream {
288-
internal final class _Storage: UnsafeSendable {
288+
internal final class _Storage: @unchecked Sendable {
289289
typealias TerminationHandler = @Sendable (Continuation.Termination) -> Void
290290
enum Terminal {
291291
case finished
@@ -543,7 +543,7 @@ extension AsyncThrowingStream {
543543
}
544544

545545
// this is used to store closures; which are two words
546-
final class _AsyncStreamCriticalStorage<Contents>: UnsafeSendable {
546+
final class _AsyncStreamCriticalStorage<Contents>: @unchecked Sendable {
547547
var _value: Contents
548548
private init(_doNotCallMe: ()) {
549549
fatalError("_AsyncStreamCriticalStorage must be initialized by create")

stdlib/public/Concurrency/CheckedContinuation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ internal final class CheckedContinuationCanary {
110110
/// enough to obtain the extra checking without further source modification in
111111
/// most circumstances.
112112
@available(SwiftStdlib 5.1, *)
113-
public struct CheckedContinuation<T, E: Error>: UnsafeSendable {
113+
public struct CheckedContinuation<T, E: Error>: @unchecked Sendable {
114114
private let canary: CheckedContinuationCanary
115115

116116
/// Initialize a `CheckedContinuation` wrapper around an

stdlib/public/Concurrency/Executor.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ internal func _enqueueOnDispatchQueue(_ job: UnownedJob,
111111
/// means a dispatch_queue_t, which is not the same as DispatchQueue
112112
/// on platforms where that is an instance of a wrapper class.
113113
@available(SwiftStdlib 5.1, *)
114-
internal final class DispatchQueueShim: UnsafeSendable, SerialExecutor {
114+
internal final class DispatchQueueShim: @unchecked Sendable, SerialExecutor {
115115
func enqueue(_ job: UnownedJob) {
116116
_enqueueOnDispatchQueue(job, queue: self)
117117
}
@@ -120,4 +120,4 @@ internal final class DispatchQueueShim: UnsafeSendable, SerialExecutor {
120120
return UnownedSerialExecutor(ordinary: self)
121121
}
122122
}
123-
#endif
123+
#endif

stdlib/public/core/Array.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1990,4 +1990,4 @@ internal struct _ArrayAnyHashableBox<Element: Hashable>
19901990
}
19911991
}
19921992

1993-
extension Array: Sendable, UnsafeSendable where Element: Sendable { }
1993+
extension Array: @unchecked Sendable where Element: Sendable { }

stdlib/public/core/ArrayBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,6 @@ extension _ArrayBuffer {
693693
}
694694
}
695695

696-
extension _ArrayBuffer: Sendable, UnsafeSendable
696+
extension _ArrayBuffer: @unchecked Sendable
697697
where Element: Sendable { }
698698
#endif

stdlib/public/core/ArraySlice.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ extension ArraySlice {
15061506
}
15071507
}
15081508

1509-
extension ArraySlice: Sendable, UnsafeSendable
1509+
extension ArraySlice: @unchecked Sendable
15101510
where Element: Sendable { }
15111511

15121512
#if INTERNAL_CHECKS_ENABLED

stdlib/public/core/ContiguousArray.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,5 +1426,5 @@ extension ContiguousArray {
14261426
}
14271427
}
14281428

1429-
extension ContiguousArray: Sendable, UnsafeSendable
1429+
extension ContiguousArray: @unchecked Sendable
14301430
where Element: Sendable { }

stdlib/public/core/Dictionary.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,17 +2101,17 @@ public typealias DictionaryIndex<Key: Hashable, Value> =
21012101
public typealias DictionaryIterator<Key: Hashable, Value> =
21022102
Dictionary<Key, Value>.Iterator
21032103

2104-
extension Dictionary: Sendable, UnsafeSendable
2104+
extension Dictionary: @unchecked Sendable
21052105
where Key: Sendable, Value: Sendable { }
2106-
extension Dictionary.Keys: Sendable, UnsafeSendable
2106+
extension Dictionary.Keys: @unchecked Sendable
21072107
where Key: Sendable, Value: Sendable { }
2108-
extension Dictionary.Values: Sendable, UnsafeSendable
2108+
extension Dictionary.Values: @unchecked Sendable
21092109
where Key: Sendable, Value: Sendable { }
2110-
extension Dictionary.Keys.Iterator: Sendable, UnsafeSendable
2110+
extension Dictionary.Keys.Iterator: @unchecked Sendable
21112111
where Key: Sendable, Value: Sendable { }
2112-
extension Dictionary.Values.Iterator: Sendable, UnsafeSendable
2112+
extension Dictionary.Values.Iterator: @unchecked Sendable
21132113
where Key: Sendable, Value: Sendable { }
2114-
extension Dictionary.Index: Sendable, UnsafeSendable
2114+
extension Dictionary.Index: @unchecked Sendable
21152115
where Key: Sendable, Value: Sendable { }
2116-
extension Dictionary.Iterator: Sendable, UnsafeSendable
2116+
extension Dictionary.Iterator: @unchecked Sendable
21172117
where Key: Sendable, Value: Sendable { }

stdlib/public/core/KeyValuePairs.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,5 @@ extension KeyValuePairs: CustomDebugStringConvertible {
140140
}
141141
}
142142

143-
// TODO: Remove UnsafeSendable when we have tuples conforming
144-
extension KeyValuePairs: Sendable, UnsafeSendable
143+
extension KeyValuePairs: Sendable
145144
where Key: Sendable, Value: Sendable { }

stdlib/public/core/Set.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,9 +1639,9 @@ extension Set {
16391639
public typealias SetIndex<Element: Hashable> = Set<Element>.Index
16401640
public typealias SetIterator<Element: Hashable> = Set<Element>.Iterator
16411641

1642-
extension Set: Sendable, UnsafeSendable
1642+
extension Set: @unchecked Sendable
16431643
where Element: Sendable { }
1644-
extension Set.Index: Sendable, UnsafeSendable
1644+
extension Set.Index: @unchecked Sendable
16451645
where Element: Sendable { }
1646-
extension Set.Iterator: Sendable, UnsafeSendable
1646+
extension Set.Iterator: @unchecked Sendable
16471647
where Element: Sendable { }

0 commit comments

Comments
 (0)