Skip to content

Commit 4ab2d5d

Browse files
committed
[span] remove the _elementsEqual() functions
We should only add them once they reach their final form.
1 parent c417cfe commit 4ab2d5d

File tree

1 file changed

+0
-83
lines changed

1 file changed

+0
-83
lines changed

stdlib/public/core/Span/Span.swift

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -323,89 +323,6 @@ extension Span where Element: BitwiseCopyable {
323323
}
324324
}
325325

326-
@_disallowFeatureSuppression(NonescapableTypes)
327-
@available(SwiftStdlib 6.1, *)
328-
extension Span where Element: Equatable {
329-
330-
/// Returns a Boolean value indicating whether this and another span
331-
/// contain equal elements in the same order.
332-
///
333-
/// - Parameters:
334-
/// - other: A span to compare to this one.
335-
/// - Returns: `true` if this sequence and `other` contain equivalent items,
336-
/// using `areEquivalent` as the equivalence test; otherwise, `false.`
337-
///
338-
/// - Complexity: O(*m*), where *m* is the lesser of the length of the
339-
/// sequence and the length of `other`.
340-
@_disallowFeatureSuppression(NonescapableTypes)
341-
@_alwaysEmitIntoClient
342-
public func _elementsEqual(_ other: Self) -> Bool {
343-
guard count == other.count else { return false }
344-
if count == 0 { return true }
345-
346-
// This could be short-cut with a layout constraint
347-
// where stride equals size, as long as there is
348-
// at most 1 unused bit pattern, e.g.:
349-
// if Element is BitwiseEquatable {
350-
// return _swift_stdlib_memcmp(lhs.baseAddress, rhs.baseAddress, count) == 0
351-
// }
352-
if _pointer != other._pointer {
353-
for o in 0..<count {
354-
if self[unchecked: o] != other[unchecked: o] { return false }
355-
}
356-
}
357-
return true
358-
}
359-
360-
/// Returns a Boolean value indicating whether this span and a Collection
361-
/// contain equal elements in the same order.
362-
///
363-
/// - Parameters:
364-
/// - other: A Collection to compare to this span.
365-
/// - Returns: `true` if this sequence and `other` contain equivalent items,
366-
/// using `areEquivalent` as the equivalence test; otherwise, `false.`
367-
///
368-
/// - Complexity: O(*m*), where *m* is the lesser of the length of the
369-
/// sequence and the length of `other`.
370-
@_disallowFeatureSuppression(NonescapableTypes)
371-
@_alwaysEmitIntoClient
372-
public func _elementsEqual(_ other: some Collection<Element>) -> Bool {
373-
#if hasFeature(LifetimeDependence)
374-
let equal = other.withContiguousStorageIfAvailable {
375-
_elementsEqual(Span(_unsafeElements: $0))
376-
}
377-
if let equal { return equal }
378-
#endif
379-
380-
guard count == other.count else { return false }
381-
if count == 0 { return true }
382-
383-
return _elementsEqual(AnySequence(other))
384-
}
385-
386-
/// Returns a Boolean value indicating whether this span and a Sequence
387-
/// contain equal elements in the same order.
388-
///
389-
/// - Parameters:
390-
/// - other: A Sequence to compare to this span.
391-
/// - Returns: `true` if this sequence and `other` contain equivalent items,
392-
/// using `areEquivalent` as the equivalence test; otherwise, `false.`
393-
///
394-
/// - Complexity: O(*m*), where *m* is the lesser of the length of the
395-
/// sequence and the length of `other`.
396-
@_disallowFeatureSuppression(NonescapableTypes)
397-
@_alwaysEmitIntoClient
398-
public func _elementsEqual(_ other: some Sequence<Element>) -> Bool {
399-
var offset = 0
400-
for otherElement in other {
401-
if offset >= count { return false }
402-
if self[unchecked: offset] != otherElement { return false }
403-
offset += 1
404-
}
405-
return offset == count
406-
}
407-
}
408-
409326
@_disallowFeatureSuppression(NonescapableTypes)
410327
@available(SwiftStdlib 6.1, *)
411328
extension Span where Element: ~Copyable {

0 commit comments

Comments
 (0)