diff --git a/stdlib/public/core/BridgeObjectiveC.swift b/stdlib/public/core/BridgeObjectiveC.swift
index 2b0694534c6..1a4e1fbaf13 100644
--- a/stdlib/public/core/BridgeObjectiveC.swift
+++ b/stdlib/public/core/BridgeObjectiveC.swift
@@ -469,6 +469,14 @@ public struct AutoreleasingUnsafeMutablePointer
guard let unwrapped = from else { return nil }
self.init(unwrapped)
}
+
+ @_transparent
+ public static func == (
+ lhs: AutoreleasingUnsafeMutablePointer,
+ rhs: AutoreleasingUnsafeMutablePointer
+ ) -> Bool {
+ return Bool(Builtin.cmp_eq_RawPointer(lhs._rawValue, rhs._rawValue))
+ }
}
extension UnsafeMutableRawPointer {
@@ -523,14 +531,6 @@ extension AutoreleasingUnsafeMutablePointer : CustomDebugStringConvertible {
}
}
-@_transparent
-public func == (
- lhs: AutoreleasingUnsafeMutablePointer,
- rhs: AutoreleasingUnsafeMutablePointer
-) -> Bool {
- return Bool(Builtin.cmp_eq_RawPointer(lhs._rawValue, rhs._rawValue))
-}
-
@_fixed_layout
@_versioned
internal struct _CocoaFastEnumerationStackBuf {
diff --git a/stdlib/public/core/DropWhile.swift.gyb b/stdlib/public/core/DropWhile.swift.gyb
index 9d009e86623..477c62932de 100644
--- a/stdlib/public/core/DropWhile.swift.gyb
+++ b/stdlib/public/core/DropWhile.swift.gyb
@@ -103,20 +103,18 @@ extension LazySequenceProtocol {
public struct LazyDropWhileIndex : Comparable {
/// The position corresponding to `self` in the underlying collection.
public let base: Base.Index
-}
-public func == (
- lhs: LazyDropWhileIndex,
- rhs: LazyDropWhileIndex
-) -> Bool {
- return lhs.base == rhs.base
-}
+ public static func == (
+ lhs: LazyDropWhileIndex, rhs: LazyDropWhileIndex
+ ) -> Bool {
+ return lhs.base == rhs.base
+ }
-public func < (
- lhs: LazyDropWhileIndex,
- rhs: LazyDropWhileIndex
-) -> Bool {
- return lhs.base < rhs.base
+ public static func < (
+ lhs: LazyDropWhileIndex, rhs: LazyDropWhileIndex
+ ) -> Bool {
+ return lhs.base < rhs.base
+ }
}
% for Traversal in ['Forward', 'Bidirectional']:
diff --git a/stdlib/public/core/FloatingPoint.swift.gyb b/stdlib/public/core/FloatingPoint.swift.gyb
index 9d1215b938e..426220b57b5 100644
--- a/stdlib/public/core/FloatingPoint.swift.gyb
+++ b/stdlib/public/core/FloatingPoint.swift.gyb
@@ -1424,12 +1424,12 @@ public enum FloatingPointRoundingRule {
case awayFromZero
}
-@_transparent
-public func == (lhs: T, rhs: T) -> Bool {
- return lhs.isEqual(to: rhs)
-}
-
extension FloatingPoint {
+ @_transparent
+ public static func == (lhs: Self, rhs: Self) -> Bool {
+ return lhs.isEqual(to: rhs)
+ }
+
@_transparent
public static func < (lhs: Self, rhs: Self) -> Bool {
return lhs.isLess(than: rhs)
diff --git a/stdlib/public/core/ManagedBuffer.swift b/stdlib/public/core/ManagedBuffer.swift
index 110e64e39bb..25b8b45d20a 100644
--- a/stdlib/public/core/ManagedBuffer.swift
+++ b/stdlib/public/core/ManagedBuffer.swift
@@ -427,17 +427,16 @@ public struct ManagedBufferPointer : Equatable {
_headerOffset + MemoryLayout.size,
toAlignment: MemoryLayout.alignment)
}
+
+ public static func == (
+ lhs: ManagedBufferPointer, rhs: ManagedBufferPointer
+ ) -> Bool {
+ return lhs._address == rhs._address
+ }
internal var _nativeBuffer: Builtin.NativeObject
}
-public func == (
- lhs: ManagedBufferPointer,
- rhs: ManagedBufferPointer
-) -> Bool {
- return lhs._address == rhs._address
-}
-
// FIXME: when our calling convention changes to pass self at +0,
// inout should be dropped from the arguments to these functions.
// FIXME(docs): isKnownUniquelyReferenced should check weak/unowned counts too,
diff --git a/stdlib/public/core/PrefixWhile.swift.gyb b/stdlib/public/core/PrefixWhile.swift.gyb
index ca234d31624..14166c9f94a 100644
--- a/stdlib/public/core/PrefixWhile.swift.gyb
+++ b/stdlib/public/core/PrefixWhile.swift.gyb
@@ -111,33 +111,31 @@ public struct LazyPrefixWhileIndex : Comparable {
internal init(endOf: Base) {
self._value = .pastEnd
}
-}
-public func == (
- lhs: LazyPrefixWhileIndex,
- rhs: LazyPrefixWhileIndex
-) -> Bool {
- switch (lhs._value, rhs._value) {
- case let (.index(l), .index(r)):
- return l == r
- case (.pastEnd, .pastEnd):
- return true
- default:
- return false
+ public static func == (
+ lhs: LazyPrefixWhileIndex, rhs: LazyPrefixWhileIndex
+ ) -> Bool {
+ switch (lhs._value, rhs._value) {
+ case let (.index(l), .index(r)):
+ return l == r
+ case (.pastEnd, .pastEnd):
+ return true
+ default:
+ return false
+ }
}
-}
-public func < (
- lhs: LazyPrefixWhileIndex,
- rhs: LazyPrefixWhileIndex
-) -> Bool {
- switch (lhs._value, rhs._value) {
- case let (.index(l), .index(r)):
- return l < r
- case (.index, .pastEnd):
- return true
- default:
- return false
+ public static func < (
+ lhs: LazyPrefixWhileIndex, rhs: LazyPrefixWhileIndex
+ ) -> Bool {
+ switch (lhs._value, rhs._value) {
+ case let (.index(l), .index(r)):
+ return l < r
+ case (.index, .pastEnd):
+ return true
+ default:
+ return false
+ }
}
}
diff --git a/stdlib/public/core/Stride.swift.gyb b/stdlib/public/core/Stride.swift.gyb
index 7576e7d1e29..27a51256ceb 100644
--- a/stdlib/public/core/Stride.swift.gyb
+++ b/stdlib/public/core/Stride.swift.gyb
@@ -55,15 +55,16 @@ public protocol ${Self} : ${Conformance} {
% end
-/// Compare two `Strideable`s.
-@_inlineable
-public func < (x: T, y: T) -> Bool {
- return x.distance(to: y) > 0
-}
+extension Strideable {
+ @_inlineable
+ public static func < (x: Self, y: Self) -> Bool {
+ return x.distance(to: y) > 0
+ }
-@_inlineable
-public func == (x: T, y: T) -> Bool {
- return x.distance(to: y) == 0
+ @_inlineable
+ public static func == (x: Self, y: Self) -> Bool {
+ return x.distance(to: y) == 0
+ }
}
//===----------------------------------------------------------------------===//