Skip to content

Commit 1f96583

Browse files
committed
[stdlib] a better pointer as associated object id
1 parent e3f4c5e commit 1f96583

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

stdlib/public/core/StringGuts.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,9 @@ extension _StringGuts {
422422

423423
private static var associationKey: UnsafeRawPointer {
424424
// We never dereference this, we just use this address as a unique key
425-
// TODO: perhaps use the address of a metatype instead
426-
unsafe UnsafeRawPointer(Builtin.addressof(&_swiftEmptyArrayStorage))
425+
unsafe unsafeBitCast(
426+
ObjectIdentifier(_StringGuts.self), to: UnsafeRawPointer.self
427+
)
427428
}
428429

429430
internal func getAssociatedStorage() -> __StringStorage? {

0 commit comments

Comments
 (0)