From dc3893d9ca60a37db7ff2cffe8ee3f37febb1ddc Mon Sep 17 00:00:00 2001 From: Holly Borla Date: Thu, 25 Jul 2024 21:51:56 -0700 Subject: [PATCH] [Concurrency] Remove redundant `Sendable` conformances in the standard library. These conformances are all redundant because the `Sendable` conformance is inherited from a superclass. --- .../public/core/ContiguousArrayBuffer.swift | 12 ---------- stdlib/public/core/DictionaryBridging.swift | 3 --- stdlib/public/core/DictionaryStorage.swift | 9 ------- .../public/core/ExistentialCollection.swift | 24 ------------------- stdlib/public/core/SetStorage.swift | 9 ------- stdlib/public/core/SwiftNativeNSArray.swift | 12 ---------- 6 files changed, 69 deletions(-) diff --git a/stdlib/public/core/ContiguousArrayBuffer.swift b/stdlib/public/core/ContiguousArrayBuffer.swift index bc4a6538d1acb..64b04c2089db0 100644 --- a/stdlib/public/core/ContiguousArrayBuffer.swift +++ b/stdlib/public/core/ContiguousArrayBuffer.swift @@ -63,9 +63,6 @@ internal final class __EmptyArrayStorage } } -@available(*, unavailable) -extension __EmptyArrayStorage: Sendable {} - #if $Embedded // In embedded Swift, the stdlib is a .swiftmodule only without any .o/.a files, // to allow consuming it by clients with different LLVM codegen setting (-mcpu @@ -120,9 +117,6 @@ internal final class __StaticArrayStorage } } -@available(*, unavailable) -extension __StaticArrayStorage: Sendable {} - /// The empty array prototype. We use the same object for all empty /// `[Native]Array`s. @inlinable @@ -312,9 +306,6 @@ internal final class _ContiguousArrayStorage< } } -@available(*, unavailable) -extension _ContiguousArrayStorage: Sendable {} - @_alwaysEmitIntoClient @inline(__always) internal func _uncheckedUnsafeBitCast(_ x: T, to type: U.Type) -> U { @@ -977,9 +968,6 @@ internal struct _ContiguousArrayBuffer: _ArrayBufferProtocol { } } -@available(*, unavailable) -extension _ContiguousArrayBuffer: Sendable {} - /// Append the elements of `rhs` to `lhs`. @inlinable internal func += ( diff --git a/stdlib/public/core/DictionaryBridging.swift b/stdlib/public/core/DictionaryBridging.swift index 020f4210cceb3..5d58267e4f3e4 100644 --- a/stdlib/public/core/DictionaryBridging.swift +++ b/stdlib/public/core/DictionaryBridging.swift @@ -421,9 +421,6 @@ final internal class _SwiftDeferredNSDictionary } } -@available(*, unavailable) -extension _SwiftDeferredNSDictionary: Sendable {} - // NOTE: older runtimes called this struct _CocoaDictionary. The two // must coexist without conflicting ObjC class names from the nested // classes, so it was renamed. The old names must not be used in the new diff --git a/stdlib/public/core/DictionaryStorage.swift b/stdlib/public/core/DictionaryStorage.swift index b9953c5cdf684..3d3cfa3c1f343 100644 --- a/stdlib/public/core/DictionaryStorage.swift +++ b/stdlib/public/core/DictionaryStorage.swift @@ -110,9 +110,6 @@ internal class __RawDictionaryStorage: __SwiftNativeNSDictionary { } } -@available(*, unavailable) -extension __RawDictionaryStorage: Sendable {} - /// The storage class for the singleton empty set. /// The single instance of this class is created by the runtime. // NOTE: older runtimes called this class _EmptyDictionarySingleton. @@ -139,9 +136,6 @@ internal class __EmptyDictionarySingleton: __RawDictionaryStorage { #endif } -@available(*, unavailable) -extension __EmptyDictionarySingleton: Sendable {} - #if _runtime(_ObjC) extension __EmptyDictionarySingleton: _NSDictionaryCore { @objc(copyWithZone:) @@ -511,6 +505,3 @@ extension _DictionaryStorage { return storage } } - -extension _DictionaryStorage: @unchecked Sendable - where Key: Sendable, Value: Sendable {} diff --git a/stdlib/public/core/ExistentialCollection.swift b/stdlib/public/core/ExistentialCollection.swift index 611e3f5136eba..b3c0a8496e5bb 100644 --- a/stdlib/public/core/ExistentialCollection.swift +++ b/stdlib/public/core/ExistentialCollection.swift @@ -166,9 +166,6 @@ internal final class _IteratorBox internal var _base: Base } -@available(*, unavailable) -extension _IteratorBox: Sendable {} - //===--- Sequence ---------------------------------------------------------===// //===----------------------------------------------------------------------===// @@ -402,9 +399,6 @@ internal class _AnyCollectionBox: _AnySequenceBox { ) -> _AnyCollectionBox { _abstract() } } -@available(*, unavailable) -extension _AnyCollectionBox: Sendable {} - @_fixed_layout @usableFromInline internal class _AnyBidirectionalCollectionBox @@ -468,9 +462,6 @@ internal class _AnyBidirectionalCollectionBox internal func _formIndex(before i: _AnyIndexBox) { _abstract() } } -@available(*, unavailable) -extension _AnyBidirectionalCollectionBox: Sendable {} - @_fixed_layout @usableFromInline internal class _AnyRandomAccessCollectionBox @@ -528,9 +519,6 @@ internal class _AnyRandomAccessCollectionBox ) -> _AnyRandomAccessCollectionBox { _abstract() } } -@available(*, unavailable) -extension _AnyRandomAccessCollectionBox: Sendable {} - @_fixed_layout @usableFromInline internal final class _SequenceBox: _AnySequenceBox { @@ -623,9 +611,6 @@ internal final class _SequenceBox: _AnySequenceBox { internal var _base: S } -@available(*, unavailable) -extension _SequenceBox: Sendable {} - @_fixed_layout @usableFromInline internal final class _CollectionBox: _AnyCollectionBox @@ -820,9 +805,6 @@ internal final class _CollectionBox: _AnyCollectionBox internal var _base: S } -@available(*, unavailable) -extension _CollectionBox: Sendable {} - @_fixed_layout @usableFromInline internal final class _BidirectionalCollectionBox @@ -1036,9 +1018,6 @@ internal final class _BidirectionalCollectionBox internal var _base: S } -@available(*, unavailable) -extension _BidirectionalCollectionBox: Sendable {} - @_fixed_layout @usableFromInline internal final class _RandomAccessCollectionBox @@ -1251,9 +1230,6 @@ internal final class _RandomAccessCollectionBox internal var _base: S } -@available(*, unavailable) -extension _RandomAccessCollectionBox: Sendable {} - @usableFromInline @frozen internal struct _ClosureBasedSequence { diff --git a/stdlib/public/core/SetStorage.swift b/stdlib/public/core/SetStorage.swift index 87bb53750f660..37d3d326aeb59 100644 --- a/stdlib/public/core/SetStorage.swift +++ b/stdlib/public/core/SetStorage.swift @@ -105,9 +105,6 @@ internal class __RawSetStorage: __SwiftNativeNSSet { } } -@available(*, unavailable) -extension __RawSetStorage: Sendable {} - /// The storage class for the singleton empty set. /// The single instance of this class is created by the runtime. // NOTE: older runtimes called this class _EmptySetSingleton. The two @@ -130,9 +127,6 @@ internal class __EmptySetSingleton: __RawSetStorage { #endif } -@available(*, unavailable) -extension __EmptySetSingleton: Sendable {} - #if $Embedded // In embedded Swift, the stdlib is a .swiftmodule only without any .o/.a files, // to allow consuming it by clients with different LLVM codegen setting (-mcpu @@ -316,9 +310,6 @@ final internal class _SetStorage #endif } -@available(*, unavailable) -extension _SetStorage: Sendable {} - extension _SetStorage { @usableFromInline @_effects(releasenone) diff --git a/stdlib/public/core/SwiftNativeNSArray.swift b/stdlib/public/core/SwiftNativeNSArray.swift index e13365250c90a..3c4f93b2a0034 100644 --- a/stdlib/public/core/SwiftNativeNSArray.swift +++ b/stdlib/public/core/SwiftNativeNSArray.swift @@ -61,9 +61,6 @@ internal class __SwiftNativeNSArrayWithContiguousStorage } } -@available(*, unavailable) -extension __SwiftNativeNSArrayWithContiguousStorage: Sendable {} - private let NSNotFound: Int = .max // Implement the APIs required by NSArray @@ -325,9 +322,6 @@ extension __SwiftNativeNSArrayWithContiguousStorage { } } -@available(*, unavailable) -extension _SwiftNSMutableArray: Sendable {} - /// An `NSArray` whose contiguous storage is created and filled, upon /// first access, by bridging the elements of a Swift `Array`. /// @@ -435,9 +429,6 @@ extension _SwiftNSMutableArray: Sendable {} } } -@available(*, unavailable) -extension __SwiftDeferredNSArray: Sendable {} - /// A `__SwiftDeferredNSArray` which is used for static read-only Swift Arrays. /// /// In contrast to its base class, `__SwiftDeferredStaticNSArray` is generic @@ -593,6 +584,3 @@ internal class __ContiguousArrayStorageBase self !== _emptyArrayStorage, "Deallocating empty array storage?!") } } - -@available(*, unavailable) -extension __ContiguousArrayStorageBase: Sendable {}