Skip to content

Commit a0751a4

Browse files
committed
[stdlib] ObjectIdentifier: Allow initialization from metatypes of noncopyable types
1 parent fb3455e commit a0751a4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

stdlib/public/core/ObjectIdentifier.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ public struct ObjectIdentifier: Sendable {
6565
public init(_ x: Any.Type) {
6666
self._value = unsafe unsafeBitCast(x, to: Builtin.RawPointer.self)
6767
}
68+
69+
@_alwaysEmitIntoClient
70+
public init(_ x: any ~Copyable.Type) {
71+
self._value = unsafeBitCast(x, to: Builtin.RawPointer.self)
72+
}
6873
}
6974

7075
#else
@@ -80,7 +85,7 @@ public struct ObjectIdentifier: Sendable {
8085
}
8186

8287
@inlinable // trivial-implementation
83-
public init<Object>(_ x: Object.Type) {
88+
public init<T: ~Copyable>(_ x: T.Type) {
8489
self._value = unsafe unsafeBitCast(x, to: Builtin.RawPointer.self)
8590
}
8691
}

0 commit comments

Comments
 (0)