Skip to content

Commit 95c7873

Browse files
committed
[stdlib] Unsafe[Mutable]RawPointer aligment for ~Escapable types
1 parent 487f06e commit 95c7873

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stdlib/public/core/UnsafeRawPointer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ extension UnsafeRawPointer {
559559
/// - Returns: a pointer properly aligned to store a value of type `T`.
560560
@inlinable
561561
@_alwaysEmitIntoClient
562-
public func alignedUp<T: ~Copyable>(for type: T.Type) -> Self {
562+
public func alignedUp<T: ~Copyable & ~Escapable>(for type: T.Type) -> Self {
563563
let mask = UInt(Builtin.alignof(T.self)) &- 1
564564
let bits = (UInt(Builtin.ptrtoint_Word(_rawValue)) &+ mask) & ~mask
565565
_debugPrecondition(bits != 0, "Overflow in pointer arithmetic")
@@ -577,7 +577,7 @@ extension UnsafeRawPointer {
577577
/// - Returns: a pointer properly aligned to store a value of type `T`.
578578
@inlinable
579579
@_alwaysEmitIntoClient
580-
public func alignedDown<T: ~Copyable>(for type: T.Type) -> Self {
580+
public func alignedDown<T: ~Copyable & ~Escapable>(for type: T.Type) -> Self {
581581
let mask = UInt(Builtin.alignof(T.self)) &- 1
582582
let bits = UInt(Builtin.ptrtoint_Word(_rawValue)) & ~mask
583583
_debugPrecondition(bits != 0, "Overflow in pointer arithmetic")
@@ -1563,7 +1563,7 @@ extension UnsafeMutableRawPointer {
15631563
/// - Returns: a pointer properly aligned to store a value of type `T`.
15641564
@inlinable
15651565
@_alwaysEmitIntoClient
1566-
public func alignedUp<T: ~Copyable>(for type: T.Type) -> Self {
1566+
public func alignedUp<T: ~Copyable & ~Escapable>(for type: T.Type) -> Self {
15671567
let mask = UInt(Builtin.alignof(T.self)) &- 1
15681568
let bits = (UInt(Builtin.ptrtoint_Word(_rawValue)) &+ mask) & ~mask
15691569
_debugPrecondition(bits != 0, "Overflow in pointer arithmetic")
@@ -1581,7 +1581,7 @@ extension UnsafeMutableRawPointer {
15811581
/// - Returns: a pointer properly aligned to store a value of type `T`.
15821582
@inlinable
15831583
@_alwaysEmitIntoClient
1584-
public func alignedDown<T: ~Copyable>(for type: T.Type) -> Self {
1584+
public func alignedDown<T: ~Copyable & ~Escapable>(for type: T.Type) -> Self {
15851585
let mask = UInt(Builtin.alignof(T.self)) &- 1
15861586
let bits = UInt(Builtin.ptrtoint_Word(_rawValue)) & ~mask
15871587
_debugPrecondition(bits != 0, "Overflow in pointer arithmetic")

0 commit comments

Comments
 (0)