Skip to content

Commit 227c1c5

Browse files
committed
[stdlib] UnsafeMutableRawPointer: load[Unaligned] ~Escapable
loadUnaligned only supports loading non-BitwiseCopyable values. The generic loadUnaligned should also be supported but it depends on UnsafePointer<T: ~Escapable>.
1 parent 95c7873 commit 227c1c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/public/core/UnsafeRawPointer.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@ extension UnsafeRawPointer {
442442
/// `offset`. The returned instance is memory-managed and unassociated
443443
/// with the value in the memory referenced by this pointer.
444444
@inlinable
445-
public func load<T>(
445+
@lifetime(borrow self)
446+
public func load<T: ~Escapable>(
446447
fromByteOffset offset: Int = 0,
447448
as type: T.Type
448449
) -> T {
@@ -488,7 +489,8 @@ extension UnsafeRawPointer {
488489
/// with the value in the range of memory referenced by this pointer.
489490
@inlinable
490491
@_alwaysEmitIntoClient
491-
public func loadUnaligned<T: BitwiseCopyable>(
492+
@lifetime(borrow self)
493+
public func loadUnaligned<T: BitwiseCopyable & ~Escapable>(
492494
fromByteOffset offset: Int = 0,
493495
as type: T.Type
494496
) -> T {

0 commit comments

Comments
 (0)