Skip to content

Commit f29cccb

Browse files
committed
[stdlib] Properly generalize ObjectIdentifier.init(Any.Type)
With Slava’s fix in swiftlang#79647, we can now refer to generalized type existentials in ABI stable code.
1 parent be1cfa3 commit f29cccb

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

stdlib/public/core/ObjectIdentifier.swift

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,23 +61,15 @@ public struct ObjectIdentifier: Sendable {
6161
///
6262
/// - Parameters:
6363
/// - x: A metatype.
64-
@inlinable // trivial-implementation
65-
public init(_ x: Any.Type) {
64+
@_alwaysEmitIntoClient
65+
public init(_ x: any (~Copyable & ~Escapable).Type) {
6666
self._value = unsafe unsafeBitCast(x, to: Builtin.RawPointer.self)
6767
}
6868

69-
/// Creates an instance that uniquely identifies the given metatype.
70-
///
71-
/// - Parameters:
72-
/// - x: A metatype.
73-
@_alwaysEmitIntoClient
74-
@_disfavoredOverload
75-
public init<T: ~Copyable & ~Escapable>(_ x: T.Type) {
76-
// FIXME: This should rather use an existential:
77-
// FIXME: init(_ x: any (~Copyable & ~Escapable).Type)
78-
// FIXME: Unfortunately, that syntax does not survive into the
79-
// FIXME: swiftinterface. rdar://139465298
80-
self._value = unsafeBitCast(x, to: Builtin.RawPointer.self)
69+
@_spi(SwiftStdlibLegacyABI) @available(swift, obsoleted: 1)
70+
@usableFromInline
71+
internal init(_ x: Any.Type) {
72+
self._value = unsafe unsafeBitCast(x, to: Builtin.RawPointer.self)
8173
}
8274
}
8375

0 commit comments

Comments
 (0)