Skip to content

Commit fa7bb2e

Browse files
committed
Make some key MutableSpan APIs transparent
These are trivial operations that: * Should always be inlined * Should behave like intrinsics for debugging purposes
1 parent 01360d1 commit fa7bb2e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

stdlib/public/core/Span/MutableSpan.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ extension MutableSpan where Element: ~Copyable {
8989

9090
@unsafe
9191
@_alwaysEmitIntoClient
92+
@_transparent
9293
@lifetime(borrow start)
9394
public init(
9495
_unsafeStart start: UnsafeMutablePointer<Element>,
@@ -295,10 +296,12 @@ extension MutableSpan where Element: ~Copyable {
295296
/// - Complexity: O(1)
296297
@_alwaysEmitIntoClient
297298
public subscript(_ position: Index) -> Element {
299+
@_transparent
298300
unsafeAddress {
299301
_checkIndex(position)
300302
return unsafe UnsafePointer(_unsafeAddressOfElement(unchecked: position))
301303
}
304+
@_transparent
302305
@lifetime(self: copy self)
303306
unsafeMutableAddress {
304307
_checkIndex(position)
@@ -317,9 +320,11 @@ extension MutableSpan where Element: ~Copyable {
317320
@unsafe
318321
@_alwaysEmitIntoClient
319322
public subscript(unchecked position: Index) -> Element {
323+
@_transparent
320324
unsafeAddress {
321325
unsafe UnsafePointer(_unsafeAddressOfElement(unchecked: position))
322326
}
327+
@_transparent
323328
@lifetime(self: copy self)
324329
unsafeMutableAddress {
325330
unsafe _unsafeAddressOfElement(unchecked: position)

0 commit comments

Comments
 (0)