diff --git a/stdlib/public/core/ClosedRange.swift b/stdlib/public/core/ClosedRange.swift index 7b6b5a1991805..a9d16cb6baef5 100644 --- a/stdlib/public/core/ClosedRange.swift +++ b/stdlib/public/core/ClosedRange.swift @@ -571,6 +571,9 @@ extension ClosedRange { } } +extension ClosedRange: BitwiseCopyable where Bound: BitwiseCopyable {} +extension ClosedRange.Index: BitwiseCopyable where Bound: BitwiseCopyable {} + // Note: this is not for compatibility only, it is considered a useful // shorthand. TODO: Add documentation public typealias CountableClosedRange = ClosedRange diff --git a/stdlib/public/core/Collection.swift b/stdlib/public/core/Collection.swift index b56f3d15b9d6d..c277b6af963d7 100644 --- a/stdlib/public/core/Collection.swift +++ b/stdlib/public/core/Collection.swift @@ -130,6 +130,9 @@ extension IndexingIterator: IteratorProtocol, Sequence { } } +extension IndexingIterator: BitwiseCopyable + where Elements: BitwiseCopyable, Elements.Index: BitwiseCopyable {} + extension IndexingIterator: Sendable where Elements: Sendable, Elements.Index: Sendable { } diff --git a/stdlib/public/core/CollectionOfOne.swift b/stdlib/public/core/CollectionOfOne.swift index 19321e303e0bd..34d4e74a1a396 100644 --- a/stdlib/public/core/CollectionOfOne.swift +++ b/stdlib/public/core/CollectionOfOne.swift @@ -194,6 +194,11 @@ extension CollectionOfOne: CustomDebugStringConvertible { } } +extension CollectionOfOne: BitwiseCopyable +where Element: BitwiseCopyable { } +extension CollectionOfOne.Iterator: BitwiseCopyable +where Element: BitwiseCopyable { } + #if SWIFT_ENABLE_REFLECTION extension CollectionOfOne: CustomReflectable { public var customMirror: Mirror { diff --git a/stdlib/public/core/EnumeratedSequence.swift b/stdlib/public/core/EnumeratedSequence.swift index 21259cb36a493..07383a1e05c17 100644 --- a/stdlib/public/core/EnumeratedSequence.swift +++ b/stdlib/public/core/EnumeratedSequence.swift @@ -38,6 +38,8 @@ public struct EnumeratedSequence { } } +extension EnumeratedSequence: BitwiseCopyable where Base: BitwiseCopyable {} + extension EnumeratedSequence: Sendable where Base: Sendable {} extension EnumeratedSequence { @@ -71,6 +73,9 @@ extension EnumeratedSequence { } } +extension EnumeratedSequence.Iterator: BitwiseCopyable +where Base.Iterator: BitwiseCopyable {} + extension EnumeratedSequence.Iterator: Sendable where Base.Iterator: Sendable {} extension EnumeratedSequence.Iterator: IteratorProtocol, Sequence { diff --git a/stdlib/public/core/Flatten.swift b/stdlib/public/core/Flatten.swift index fa56506673aa0..467ce176c4086 100644 --- a/stdlib/public/core/Flatten.swift +++ b/stdlib/public/core/Flatten.swift @@ -38,6 +38,8 @@ public struct FlattenSequence where Base.Element: Sequence { } } +extension FlattenSequence: BitwiseCopyable where Base: BitwiseCopyable {} + extension FlattenSequence: Sendable where Base: Sendable {} extension FlattenSequence { @@ -56,6 +58,10 @@ extension FlattenSequence { } } +extension FlattenSequence.Iterator: BitwiseCopyable + where Base.Iterator: BitwiseCopyable, + Base.Element.Iterator: BitwiseCopyable {} + extension FlattenSequence.Iterator: Sendable where Base.Iterator: Sendable, Base.Element.Iterator: Sendable {} @@ -167,6 +173,9 @@ extension FlattenSequence where Base: Collection, Base.Element: Collection { } } +extension FlattenSequence.Index: BitwiseCopyable + where Base.Index: BitwiseCopyable, Base.Element.Index: BitwiseCopyable {} + extension FlattenSequence.Index: Sendable where Base.Index: Sendable, Base.Element.Index: Sendable {} diff --git a/stdlib/public/core/Indices.swift b/stdlib/public/core/Indices.swift index 84f72ff28274b..9ad38c348bdfe 100644 --- a/stdlib/public/core/Indices.swift +++ b/stdlib/public/core/Indices.swift @@ -145,5 +145,8 @@ extension Collection where Indices == DefaultIndices { } } +extension DefaultIndices: BitwiseCopyable + where Elements: BitwiseCopyable, Elements.Index: BitwiseCopyable { } + extension DefaultIndices: Sendable where Elements: Sendable, Elements.Index: Sendable { } diff --git a/stdlib/public/core/LazySequence.swift b/stdlib/public/core/LazySequence.swift index 6139a1a64fa38..e8cb7ef8bd31b 100644 --- a/stdlib/public/core/LazySequence.swift +++ b/stdlib/public/core/LazySequence.swift @@ -188,6 +188,8 @@ public struct LazySequence { } } +extension LazySequence: BitwiseCopyable where Base: BitwiseCopyable {} + extension LazySequence: Sendable where Base: Sendable {} extension LazySequence: Sequence { diff --git a/stdlib/public/core/Range.swift b/stdlib/public/core/Range.swift index 5f650d784ed56..d87e78a9d43d5 100644 --- a/stdlib/public/core/Range.swift +++ b/stdlib/public/core/Range.swift @@ -501,6 +501,8 @@ public struct PartialRangeUpTo { public init(_ upperBound: Bound) { self.upperBound = upperBound } } +extension PartialRangeUpTo: BitwiseCopyable where Bound: BitwiseCopyable {} + extension PartialRangeUpTo: RangeExpression { @_transparent public func relative(to collection: C) -> Range @@ -559,6 +561,8 @@ public struct PartialRangeThrough { public init(_ upperBound: Bound) { self.upperBound = upperBound } } +extension PartialRangeThrough: BitwiseCopyable where Bound: BitwiseCopyable {} + extension PartialRangeThrough: RangeExpression { @_transparent public func relative(to collection: C) -> Range @@ -676,6 +680,8 @@ public struct PartialRangeFrom { public init(_ lowerBound: Bound) { self.lowerBound = lowerBound } } +extension PartialRangeFrom: BitwiseCopyable where Bound: BitwiseCopyable {} + extension PartialRangeFrom: RangeExpression { @_transparent public func relative( @@ -723,6 +729,9 @@ extension PartialRangeFrom: Sequence } } +extension PartialRangeFrom.Iterator: BitwiseCopyable + where Bound: BitwiseCopyable {} + @_unavailableInEmbedded extension PartialRangeFrom: Decodable where Bound: Decodable { public init(from decoder: Decoder) throws { @@ -1109,6 +1118,8 @@ extension Range { } } +extension Range: BitwiseCopyable where Bound: BitwiseCopyable {} + // Note: this is not for compatibility only, it is considered a useful // shorthand. TODO: Add documentation public typealias CountableRange = Range diff --git a/stdlib/public/core/Repeat.swift b/stdlib/public/core/Repeat.swift index a86475b808f50..c632914685fba 100644 --- a/stdlib/public/core/Repeat.swift +++ b/stdlib/public/core/Repeat.swift @@ -108,4 +108,6 @@ public func repeatElement(_ element: T, count n: Int) -> Repeated { return Repeated(_repeating: element, count: n) } +extension Repeated: BitwiseCopyable where Element: BitwiseCopyable {} + extension Repeated: Sendable where Element: Sendable { } diff --git a/stdlib/public/core/Reverse.swift b/stdlib/public/core/Reverse.swift index d85d6ff523f41..de247a5fddb2e 100644 --- a/stdlib/public/core/Reverse.swift +++ b/stdlib/public/core/Reverse.swift @@ -63,6 +63,8 @@ public struct ReversedCollection { } } +extension ReversedCollection: BitwiseCopyable where Base: BitwiseCopyable {} + extension ReversedCollection: Sendable where Base: Sendable {} extension ReversedCollection { @@ -85,6 +87,9 @@ extension ReversedCollection { } } +extension ReversedCollection.Iterator: BitwiseCopyable + where Base: BitwiseCopyable, Base.Index: BitwiseCopyable {} + extension ReversedCollection.Iterator: Sendable where Base: Sendable, Base.Index: Sendable {} @@ -175,6 +180,9 @@ extension ReversedCollection { } } +extension ReversedCollection.Index: BitwiseCopyable + where Base.Index: BitwiseCopyable {} + extension ReversedCollection.Index: Sendable where Base.Index: Sendable {} extension ReversedCollection.Index: Comparable { diff --git a/stdlib/public/core/SIMDVector.swift b/stdlib/public/core/SIMDVector.swift index ee83084878b2b..b99384d04fea1 100644 --- a/stdlib/public/core/SIMDVector.swift +++ b/stdlib/public/core/SIMDVector.swift @@ -728,6 +728,8 @@ public struct SIMDMask: SIMD } } +extension SIMDMask: BitwiseCopyable where Storage: BitwiseCopyable {} + extension SIMDMask: Sendable where Storage: Sendable {} extension SIMDMask { diff --git a/stdlib/public/core/Sequence.swift b/stdlib/public/core/Sequence.swift index e34bb9d8df267..1f3a9742ed0c1 100644 --- a/stdlib/public/core/Sequence.swift +++ b/stdlib/public/core/Sequence.swift @@ -488,6 +488,8 @@ public struct DropFirstSequence { } } +extension DropFirstSequence: BitwiseCopyable where Base: BitwiseCopyable {} + extension DropFirstSequence: Sendable where Base: Sendable {} extension DropFirstSequence: Sequence { @@ -534,6 +536,8 @@ public struct PrefixSequence { } } +extension PrefixSequence: BitwiseCopyable where Base: BitwiseCopyable {} + extension PrefixSequence: Sendable where Base: Sendable {} extension PrefixSequence { @@ -552,6 +556,9 @@ extension PrefixSequence { } } +extension PrefixSequence.Iterator: BitwiseCopyable + where Base.Iterator: BitwiseCopyable {} + extension PrefixSequence.Iterator: Sendable where Base.Iterator: Sendable {} extension PrefixSequence.Iterator: IteratorProtocol { @@ -611,6 +618,9 @@ public struct DropWhileSequence { } } +extension DropWhileSequence: BitwiseCopyable + where Base.Iterator: BitwiseCopyable, Element: BitwiseCopyable {} + extension DropWhileSequence: Sendable where Base.Iterator: Sendable, Element: Sendable {} @@ -630,6 +640,9 @@ extension DropWhileSequence { } } +extension DropWhileSequence.Iterator: BitwiseCopyable + where Base.Iterator: BitwiseCopyable, Element: BitwiseCopyable {} + extension DropWhileSequence.Iterator: Sendable where Base.Iterator: Sendable, Element: Sendable {} @@ -1291,6 +1304,8 @@ extension IteratorSequence: IteratorProtocol, Sequence { } } +extension IteratorSequence: BitwiseCopyable where Base: BitwiseCopyable {} + extension IteratorSequence: Sendable where Base: Sendable { } /* FIXME: ideally for compatibility we would declare diff --git a/stdlib/public/core/Slice.swift b/stdlib/public/core/Slice.swift index f1a760fca6c5a..e92e5fd5c0f33 100644 --- a/stdlib/public/core/Slice.swift +++ b/stdlib/public/core/Slice.swift @@ -529,5 +529,8 @@ extension Slice } } +extension Slice: BitwiseCopyable +where Base: BitwiseCopyable, Base.Index: BitwiseCopyable {} + extension Slice: Sendable where Base: Sendable, Base.Index: Sendable { } diff --git a/stdlib/public/core/Stride.swift b/stdlib/public/core/Stride.swift index ab849a0dd77bb..c3437d5fc6b85 100644 --- a/stdlib/public/core/Stride.swift +++ b/stdlib/public/core/Stride.swift @@ -742,6 +742,15 @@ public func stride( return StrideThrough(_start: start, end: end, stride: stride) } +extension StrideToIterator: BitwiseCopyable + where Element: BitwiseCopyable, Element.Stride: BitwiseCopyable { } +extension StrideTo: BitwiseCopyable + where Element: BitwiseCopyable, Element.Stride: BitwiseCopyable { } +extension StrideThroughIterator: BitwiseCopyable + where Element: BitwiseCopyable, Element.Stride: BitwiseCopyable { } +extension StrideThrough: BitwiseCopyable + where Element: BitwiseCopyable, Element.Stride: BitwiseCopyable { } + extension StrideToIterator: Sendable where Element: Sendable, Element.Stride: Sendable { } extension StrideTo: Sendable diff --git a/stdlib/public/core/UnicodeParser.swift b/stdlib/public/core/UnicodeParser.swift index e18ee90dd0ac4..1a778bc6c9c01 100644 --- a/stdlib/public/core/UnicodeParser.swift +++ b/stdlib/public/core/UnicodeParser.swift @@ -60,4 +60,6 @@ extension Unicode { public typealias Parser = _UnicodeParser } +extension Unicode.ParseResult: BitwiseCopyable where T: BitwiseCopyable {} + extension Unicode.ParseResult: Sendable where T: Sendable { } diff --git a/stdlib/public/core/Zip.swift b/stdlib/public/core/Zip.swift index b1ba72009fdf1..98043ecf8f3ce 100644 --- a/stdlib/public/core/Zip.swift +++ b/stdlib/public/core/Zip.swift @@ -154,6 +154,12 @@ extension Zip2Sequence: Sequence { } } +extension Zip2Sequence: BitwiseCopyable where Sequence1: BitwiseCopyable, + Sequence2: BitwiseCopyable { } +extension Zip2Sequence.Iterator: BitwiseCopyable + where Sequence1.Iterator: BitwiseCopyable, + Sequence2.Iterator: BitwiseCopyable { } + extension Zip2Sequence: Sendable where Sequence1: Sendable, Sequence2: Sendable { } extension Zip2Sequence.Iterator: Sendable where Sequence1.Iterator: Sendable,