Skip to content

Commit 79bf5d5

Browse files
authored
Merge pull request #75782 from glessard/rdar133343460-incorrectly-sendable
[stdlib] fix sendability of ManagedBufferPointer
2 parents f9631e1 + a9a7c8a commit 79bf5d5

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

stdlib/public/core/ManagedBuffer.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ public struct ManagedBufferPointer<
374374
}
375375
}
376376

377+
@available(*, unavailable)
378+
extension ManagedBufferPointer: Sendable where Element: ~Copyable {}
379+
377380
extension ManagedBufferPointer where Element: ~Copyable {
378381
/// The stored `Header` instance.
379382
@_preInverseGenerics

test/Concurrency/sendable_checking.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,12 @@ func testPointersAreNotSendable() {
387387
testSendable(rawMutableBuffer) // expected-warning {{conformance of 'UnsafeMutableRawBufferPointer' to 'Sendable' is unavailable}}
388388
testSendable(rawMutableBuffer.makeIterator()) // expected-warning {{conformance of 'UnsafeRawBufferPointer.Iterator' to 'Sendable' is unavailable}}
389389
}
390+
391+
func testManagedBuffers(buffer1: ManagedBuffer<Int, Int>, buffer2: ManagedBufferPointer<Int, Int>) {
392+
testSendable(buffer1) // expected-warning {{conformance of 'ManagedBuffer<Header, Element>' to 'Sendable' is unavailable}}
393+
394+
testSendable(buffer2) // expected-warning {{conformance of 'ManagedBufferPointer<Header, Element>' to 'Sendable' is unavailable}}
395+
}
390396
}
391397

392398
@available(*, unavailable)

0 commit comments

Comments
 (0)