Skip to content

Commit b54c2b4

Browse files
committed
[Synchronization] Generalize U[M]BP’s AtomicRepresentable conformance
1 parent cf1c92f commit b54c2b4

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

stdlib/public/Synchronization/AtomicPointers.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ extension ObjectIdentifier: AtomicOptionalRepresentable {
774774
#if (_pointerBitWidth(_32) && _hasAtomicBitWidth(_64)) || (_pointerBitWidth(_64) && _hasAtomicBitWidth(_128))
775775

776776
@available(SwiftStdlib 6.0, *)
777-
extension UnsafeBufferPointer: AtomicRepresentable {
777+
extension UnsafeBufferPointer: AtomicRepresentable where Element: ~Copyable {
778778
/// The storage representation type that `Self` encodes to and decodes from
779779
/// which is a suitable type when used in atomic operations.
780780
@available(SwiftStdlib 6.0, *)
@@ -840,7 +840,9 @@ extension UnsafeBufferPointer: AtomicRepresentable {
840840
#if (_pointerBitWidth(_32) && _hasAtomicBitWidth(_64)) || (_pointerBitWidth(_64) && _hasAtomicBitWidth(_128))
841841

842842
@available(SwiftStdlib 6.0, *)
843-
extension UnsafeMutableBufferPointer: AtomicRepresentable {
843+
extension UnsafeMutableBufferPointer: AtomicRepresentable
844+
where Element: ~Copyable
845+
{
844846
/// The storage representation type that `Self` encodes to and decodes from
845847
/// which is a suitable type when used in atomic operations.
846848
@available(SwiftStdlib 6.0, *)

test/abi/macOS/arm64/synchronization.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,11 @@ Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRiczrlMc
461461
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
462462
Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRiczrlWP
463463

464-
// protocol conformance descriptor for Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
465-
Added: _$sSRyxG15Synchronization19AtomicRepresentableABMc
464+
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
465+
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRiczrlMc
466466

467-
// protocol witness table for Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
468-
Added: _$sSRyxG15Synchronization19AtomicRepresentableABWP
467+
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
468+
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRiczrlWP
469469

470470
// protocol conformance descriptor for Swift.UnsafeRawPointer : Synchronization.AtomicRepresentable in Synchronization
471471
Added: _$sSV15Synchronization19AtomicRepresentableAAMc
@@ -521,11 +521,11 @@ Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRiczrlMc
521521
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeMutablePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
522522
Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRiczrlWP
523523

524-
// protocol conformance descriptor for Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
525-
Added: _$sSryxG15Synchronization19AtomicRepresentableABMc
524+
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
525+
Added: _$sSryxG15Synchronization19AtomicRepresentableABRiczrlMc
526526

527-
// protocol witness table for Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
528-
Added: _$sSryxG15Synchronization19AtomicRepresentableABWP
527+
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
528+
Added: _$sSryxG15Synchronization19AtomicRepresentableABRiczrlWP
529529

530530
// protocol conformance descriptor for Swift.UInt : Synchronization.AtomicRepresentable in Synchronization
531531
Added: _$sSu15Synchronization19AtomicRepresentableAAMc

test/abi/macOS/x86_64/synchronization.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,11 @@ Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRiczrlMc
461461
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
462462
Added: _$sSPyxG15Synchronization27AtomicOptionalRepresentableABRiczrlWP
463463

464-
// protocol conformance descriptor for Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
465-
Added: _$sSRyxG15Synchronization19AtomicRepresentableABMc
464+
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
465+
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRiczrlMc
466466

467-
// protocol witness table for Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
468-
Added: _$sSRyxG15Synchronization19AtomicRepresentableABWP
467+
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
468+
Added: _$sSRyxG15Synchronization19AtomicRepresentableABRiczrlWP
469469

470470
// protocol conformance descriptor for Swift.UnsafeRawPointer : Synchronization.AtomicRepresentable in Synchronization
471471
Added: _$sSV15Synchronization19AtomicRepresentableAAMc
@@ -521,11 +521,11 @@ Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRiczrlMc
521521
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeMutablePointer<A> : Synchronization.AtomicOptionalRepresentable in Synchronization
522522
Added: _$sSpyxG15Synchronization27AtomicOptionalRepresentableABRiczrlWP
523523

524-
// protocol conformance descriptor for Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
525-
Added: _$sSryxG15Synchronization19AtomicRepresentableABMc
524+
// protocol conformance descriptor for < where A: ~Swift.Copyable> Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
525+
Added: _$sSryxG15Synchronization19AtomicRepresentableABRiczrlMc
526526

527-
// protocol witness table for Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
528-
Added: _$sSryxG15Synchronization19AtomicRepresentableABWP
527+
// protocol witness table for < where A: ~Swift.Copyable> Swift.UnsafeMutableBufferPointer<A> : Synchronization.AtomicRepresentable in Synchronization
528+
Added: _$sSryxG15Synchronization19AtomicRepresentableABRiczrlWP
529529

530530
// protocol conformance descriptor for Swift.UInt : Synchronization.AtomicRepresentable in Synchronization
531531
Added: _$sSu15Synchronization19AtomicRepresentableAAMc

0 commit comments

Comments
 (0)