mirror of
https://github.com/apple/swift-collections
synced 2026-11-25 04:37:48 +00:00
post-rebase compatibility fixes
This commit is contained in:
1 parent
dc63d5e048
commit
3f6522fef1
8 files changed
+20
-12
No files matched your search
@@ -13,6 +13,8 @@
|
||||
import InternalCollectionsUtilities
|
||||
#endif
|
||||
|
||||
import Future
|
||||
|
||||
extension Deque {
|
||||
// Implementation note: we could also use the default `IndexingIterator` here.
|
||||
// This custom implementation performs direct storage access to eliminate any
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Future
|
||||
|
||||
extension Deque: Equatable where Element: Equatable {
|
||||
/// Returns a Boolean value indicating whether two values are equal. Two
|
||||
/// deques are considered equal if they contain the same elements in the same
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import Future
|
||||
|
||||
/// A collection implementing a double-ended queue. `Deque` (pronounced "deck")
|
||||
/// implements an ordered random-access collection that supports efficient
|
||||
/// insertions and removals from both ends.
|
||||
|
||||
@@ -95,16 +95,16 @@ public struct _DequeBorrowingIterator<Element: ~Copyable>: BorrowingIteratorProt
|
||||
let d = Swift.min(maximumCount, _segments.first.count - _offset)
|
||||
let slice = _segments.first.extracting(_offset ..< _offset + d)
|
||||
_offset += d
|
||||
return Span(unsafeElements: slice, owner: self)
|
||||
return Span(_unsafeElements: slice)
|
||||
}
|
||||
guard let second = _segments.second else {
|
||||
return Span(unsafeElements: UnsafeBufferPointer._empty, owner: self)
|
||||
return Span(_unsafeElements: UnsafeBufferPointer._empty)
|
||||
}
|
||||
let o = _offset - _segments.first.count
|
||||
let d = Swift.min(maximumCount, second.count - o)
|
||||
let slice = second.extracting(o ..< o + d)
|
||||
_offset += d
|
||||
return Span(unsafeElements: slice, owner: self)
|
||||
return Span(_unsafeElements: slice)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ extension NewArray {
|
||||
// FIXME: This is what I want to write; alas, lifetimes are messed up.
|
||||
return _storage.value.storage
|
||||
#else
|
||||
return Span(unsafeElements: _storage.value._items, owner: self)
|
||||
return Span(_unsafeElements: _storage.value._items)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ extension NewArray: RangeReplaceableCollection {
|
||||
self._storage = Shared(RigidArray(capacity: 0))
|
||||
}
|
||||
|
||||
public func replaceSubrange(
|
||||
mutating public func replaceSubrange(
|
||||
_ subrange: Range<Int>,
|
||||
with newElements: some Collection<Element>
|
||||
) {
|
||||
|
||||
@@ -60,7 +60,7 @@ extension RigidArray where Element: ~Copyable {
|
||||
|
||||
extension RigidArray where Element: ~Copyable {
|
||||
public var storage: Span<Element> {
|
||||
Span(unsafeElements: _items, owner: self)
|
||||
Span(_unsafeElements: _items)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ extension RigidArray: RandomAccessContainer where Element: ~Copyable {
|
||||
let end = _offset + Swift.min(maximumCount, _items.count - _offset)
|
||||
defer { _offset = end }
|
||||
let chunk = _items.extracting(Range(uncheckedBounds: (_offset, end)))
|
||||
return Span(unsafeElements: chunk, owner: self)
|
||||
return Span(_unsafeElements: chunk)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,8 @@ extension RigidArray {
|
||||
internal func _copy(capacity: Int) -> Self {
|
||||
precondition(capacity >= count)
|
||||
var result = RigidArray<Element>(capacity: capacity)
|
||||
result._storage.initializeAll(fromContentsOf: _storage)
|
||||
let initialized = result._storage.initialize(fromContentsOf: _storage)
|
||||
precondition(initialized == count)
|
||||
result._count = count
|
||||
return result
|
||||
}
|
||||
@@ -251,7 +252,8 @@ extension RigidArray {
|
||||
internal mutating func _move(capacity: Int) -> Self {
|
||||
precondition(capacity >= count)
|
||||
var result = RigidArray<Element>(capacity: capacity)
|
||||
result._storage.moveInitializeAll(fromContentsOf: _storage)
|
||||
let initialized = result._storage.moveInitialize(fromContentsOf: _storage)
|
||||
precondition(initialized == count)
|
||||
result._count = count
|
||||
self._count = 0
|
||||
return result
|
||||
|
||||
@@ -18,13 +18,13 @@ import _CollectionsTestSupport
|
||||
#endif
|
||||
|
||||
class MeasuringHashable: Hashable {
|
||||
static var equalityChecks = 0
|
||||
nonisolated(unsafe) static var equalityChecks = 0
|
||||
static func == (lhs: MeasuringHashable, rhs: MeasuringHashable) -> Bool {
|
||||
MeasuringHashable.equalityChecks += 1
|
||||
return lhs._inner == rhs._inner
|
||||
}
|
||||
|
||||
static var hashChecks = 0
|
||||
nonisolated(unsafe) static var hashChecks = 0
|
||||
func hash(into hasher: inout Hasher) {
|
||||
MeasuringHashable.hashChecks += 1
|
||||
_inner.hash(into: &hasher)
|
||||
|
||||
@@ -20,7 +20,7 @@ public final class TestContext {
|
||||
internal var _trace: [Entry] = []
|
||||
|
||||
// FIXME: This ought to be a thread-local variable.
|
||||
internal static var _current: TestContext?
|
||||
nonisolated(unsafe) internal static var _current: TestContext?
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user