Skip to content

Commit ebdd368

Browse files
committed
Remove problematic OutputSpan initializers and dependencies
These initializers have ownership errors. Once rdar://144352938 is fixed, these can be enabled again.
1 parent c5f3618 commit ebdd368

File tree

1 file changed

+3
-144
lines changed

1 file changed

+3
-144
lines changed

test/SILOptimizer/Inputs/SpanExtras.swift

Lines changed: 3 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -528,45 +528,7 @@ extension MutableSpan {
528528
}
529529

530530
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *)
531-
extension MutableSpan where Element: ~Copyable {
532531

533-
@_alwaysEmitIntoClient
534-
public mutating func moveUpdate(
535-
fromContentsOf source: consuming OutputSpan<Element>
536-
) -> Index {
537-
guard !source.isEmpty else { return 0 }
538-
precondition(
539-
source.count <= self.count,
540-
"destination span cannot contain every element from source."
541-
)
542-
let buffer = source.relinquishBorrowedMemory()
543-
// we must now deinitialize the returned UMBP
544-
_start().moveInitializeMemory(
545-
as: Element.self, from: buffer.baseAddress!, count: buffer.count
546-
)
547-
return buffer.count
548-
}
549-
550-
public mutating func moveUpdate(
551-
fromContentsOf source: UnsafeMutableBufferPointer<Element>
552-
) -> Index {
553-
let source = OutputSpan(_initializing: source, initialized: source.count)
554-
return self.moveUpdate(fromContentsOf: source)
555-
}
556-
}
557-
558-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *)
559-
extension MutableSpan {
560-
561-
public mutating func moveUpdate(
562-
fromContentsOf source: Slice<UnsafeMutableBufferPointer<Element>>
563-
) -> Index {
564-
self.moveUpdate(fromContentsOf: .init(rebasing: source))
565-
}
566-
}
567-
568-
569-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *)
570532
extension MutableSpan where Element: BitwiseCopyable {
571533

572534
@_alwaysEmitIntoClient
@@ -698,115 +660,12 @@ public struct OutputSpan<Element: ~Copyable>: ~Copyable, ~Escapable {
698660
@available(*, unavailable)
699661
extension OutputSpan: Sendable {}
700662

701-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *)
702-
extension OutputSpan where Element: ~Copyable {
703-
704-
@usableFromInline @inline(__always)
705-
@lifetime(borrow buffer)
706-
init(
707-
_unchecked buffer: UnsafeMutableBufferPointer<Element>,
708-
initialized: Int
709-
) {
710-
_pointer = .init(buffer.baseAddress)
711-
capacity = buffer.count
712-
_initialized = initialized
713-
}
714-
715-
@_alwaysEmitIntoClient
716-
@lifetime(borrow buffer)
717-
public init(
718-
_initializing buffer: UnsafeMutableBufferPointer<Element>,
719-
initialized: Int = 0
720-
) {
721-
precondition(
722-
((Int(bitPattern: buffer.baseAddress) &
723-
(MemoryLayout<Element>.alignment&-1)) == 0),
724-
"baseAddress must be properly aligned to access Element"
725-
)
726-
self.init(_unchecked: buffer, initialized: initialized)
727-
}
728-
729-
@_alwaysEmitIntoClient
730-
@lifetime(borrow pointer)
731-
public init(
732-
_initializing pointer: UnsafeMutablePointer<Element>,
733-
capacity: Int,
734-
initialized: Int = 0
735-
) {
736-
precondition(capacity >= 0, "Capacity must be 0 or greater")
737-
let buffer = UnsafeMutableBufferPointer(start: pointer, count: capacity)
738-
let os = OutputSpan(_initializing: buffer, initialized: initialized)
739-
self = _overrideLifetime(os, borrowing: pointer)
740-
}
741-
}
742-
743-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *)
744-
extension OutputSpan {
745-
746-
@_alwaysEmitIntoClient
747-
@lifetime(borrow buffer)
748-
public init(
749-
_initializing buffer: borrowing Slice<UnsafeMutableBufferPointer<Element>>,
750-
initialized: Int = 0
751-
) {
752-
let rebased = UnsafeMutableBufferPointer(rebasing: buffer)
753-
let os = OutputSpan(_initializing: rebased, initialized: 0)
754-
self = _overrideLifetime(os, borrowing: buffer)
755-
}
756-
}
757-
758-
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *)
759-
extension OutputSpan where Element: BitwiseCopyable {
760-
761-
@_alwaysEmitIntoClient
762-
@lifetime(borrow bytes)
763-
public init(
764-
_initializing bytes: UnsafeMutableRawBufferPointer,
765-
initialized: Int = 0
766-
) {
767-
precondition(
768-
((Int(bitPattern: bytes.baseAddress) &
769-
(MemoryLayout<Element>.alignment&-1)) == 0),
770-
"baseAddress must be properly aligned to access Element"
771-
)
772-
let (byteCount, stride) = (bytes.count, MemoryLayout<Element>.stride)
773-
let (count, remainder) = byteCount.quotientAndRemainder(dividingBy: stride)
774-
precondition(remainder == 0, "Span must contain a whole number of elements")
775-
let pointer = bytes.baseAddress
776-
let os = OutputSpan(
777-
_unchecked: pointer, capacity: count, initialized: initialized
778-
)
779-
self = _overrideLifetime(os, borrowing: bytes)
780-
}
781-
782-
@_alwaysEmitIntoClient
783-
@lifetime(borrow pointer)
784-
public init(
785-
_initializing pointer: UnsafeMutableRawPointer,
786-
capacity: Int,
787-
initialized: Int = 0
788-
) {
789-
precondition(capacity >= 0, "Capacity must be 0 or greater")
790-
let buffer = UnsafeMutableRawBufferPointer(start: pointer, count: capacity)
791-
let os = OutputSpan(_initializing: buffer, initialized: initialized)
792-
self = _overrideLifetime(os, borrowing: pointer)
793-
}
794-
795-
@_alwaysEmitIntoClient
796-
@lifetime(borrow buffer)
797-
public init(
798-
_initializing buffer: borrowing Slice<UnsafeMutableRawBufferPointer>,
799-
initialized: Int = 0
800-
) {
801-
let rebased = UnsafeMutableRawBufferPointer(rebasing: buffer)
802-
let os = OutputSpan(_initializing: rebased, initialized: initialized)
803-
self = _overrideLifetime(os, borrowing: buffer)
804-
}
805-
}
806-
807663
@available(macOS 9999, iOS 9999, tvOS 9999, watchOS 9999, visionOS 9999, *)
808664
extension OutputSpan where Element: ~Copyable {
809665

666+
@available(macOS 9999, *)
667+
@available(macOS 9999, *)
668+
@available(macOS 9999, *)
810669
@_alwaysEmitIntoClient
811670
public mutating func append(_ value: consuming Element) {
812671
precondition(_initialized < capacity, "Output buffer overflow")

0 commit comments

Comments
 (0)