Skip to content

Commit a1e7172

Browse files
authored
Merge pull request #39218 from atrick/revoke-pointer-sendable
Unsafe*Pointer types should not be Sendable.
2 parents c121a77 + 689e497 commit a1e7172

File tree

7 files changed

+7
-21
lines changed

7 files changed

+7
-21
lines changed

stdlib/public/core/BridgeObjectiveC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ extension UnsafeRawPointer {
589589
}
590590
}
591591

592-
extension AutoreleasingUnsafeMutablePointer: Sendable { }
592+
extension AutoreleasingUnsafeMutablePointer { }
593593

594594
internal struct _CocoaFastEnumerationStackBuf {
595595
// Clang uses 16 pointers. So do we.

stdlib/public/core/CTypes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public typealias CBool = Bool
124124
/// Opaque pointers are used to represent C pointers to types that
125125
/// cannot be represented in Swift, such as incomplete struct types.
126126
@frozen
127-
public struct OpaquePointer: Sendable {
127+
public struct OpaquePointer {
128128
@usableFromInline
129129
internal var _rawValue: Builtin.RawPointer
130130

@@ -235,7 +235,7 @@ extension UInt {
235235
/// A wrapper around a C `va_list` pointer.
236236
#if arch(arm64) && !(os(macOS) || os(iOS) || os(tvOS) || os(watchOS) || os(Windows))
237237
@frozen
238-
public struct CVaListPointer: Sendable {
238+
public struct CVaListPointer {
239239
@usableFromInline // unsafe-performance
240240
internal var _value: (__stack: UnsafeMutablePointer<Int>?,
241241
__gr_top: UnsafeMutablePointer<Int>?,

stdlib/public/core/UnsafeBufferPointer.swift.gyb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,10 +749,6 @@ extension UnsafeMutableBufferPointer {
749749
}
750750
}
751751

752-
extension UnsafeBufferPointer: Sendable { }
753-
extension UnsafeBufferPointer.Iterator: Sendable { }
754-
extension UnsafeMutableBufferPointer: Sendable { }
755-
756752
// ${'Local Variables'}:
757753
// eval: (read-only-mode 1)
758754
// End:

stdlib/public/core/UnsafePointer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@
205205
/// let numberPointer = UnsafePointer<Int>(&number)
206206
/// // Accessing 'numberPointer' is undefined behavior.
207207
@frozen // unsafe-performance
208-
public struct UnsafePointer<Pointee>: _Pointer, Sendable {
208+
public struct UnsafePointer<Pointee>: _Pointer {
209209

210210
/// A type that represents the distance between two pointers.
211211
public typealias Distance = Int
@@ -511,7 +511,7 @@ public struct UnsafePointer<Pointee>: _Pointer, Sendable {
511511
/// let numberPointer = UnsafeMutablePointer<Int>(&number)
512512
/// // Accessing 'numberPointer' is undefined behavior.
513513
@frozen // unsafe-performance
514-
public struct UnsafeMutablePointer<Pointee>: _Pointer, Sendable {
514+
public struct UnsafeMutablePointer<Pointee>: _Pointer {
515515

516516
/// A type that represents the distance between two pointers.
517517
public typealias Distance = Int

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -856,11 +856,6 @@ public func withUnsafeBytes<T, Result>(
856856
return try body(buffer)
857857
}
858858

859-
extension UnsafeRawBufferPointer: Sendable { }
860-
extension UnsafeRawBufferPointer.Iterator: Sendable { }
861-
extension UnsafeMutableRawBufferPointer: Sendable { }
862-
863-
864859
// ${'Local Variables'}:
865860
// eval: (read-only-mode 1)
866861
// End:

stdlib/public/core/UnsafeRawPointer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
/// let numberPointer = UnsafeRawPointer(&number)
170170
/// // Accessing 'numberPointer' is undefined behavior.
171171
@frozen
172-
public struct UnsafeRawPointer: _Pointer, Sendable {
172+
public struct UnsafeRawPointer: _Pointer {
173173

174174
public typealias Pointee = UInt8
175175

@@ -527,7 +527,7 @@ extension UnsafeRawPointer: Strideable {
527527
/// let numberPointer = UnsafeMutableRawPointer(&number)
528528
/// // Accessing 'numberPointer' is undefined behavior.
529529
@frozen
530-
public struct UnsafeMutableRawPointer: _Pointer, Sendable {
530+
public struct UnsafeMutableRawPointer: _Pointer {
531531

532532
public typealias Pointee = UInt8
533533

test/SourceKit/DocSupport/doc_clang_module.swift.response

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5591,11 +5591,6 @@ var FooSubUnnamedEnumeratorA1: Int { get }
55915591
key.kind: source.lang.swift.ref.protocol,
55925592
key.name: "_Pointer",
55935593
key.usr: "s:s8_PointerP"
5594-
},
5595-
{
5596-
key.kind: source.lang.swift.ref.protocol,
5597-
key.name: "Sendable",
5598-
key.usr: "s:s8SendableP"
55995594
}
56005595
]
56015596
},

0 commit comments

Comments
 (0)