Skip to content

Commit c821c2f

Browse files
committed
[stdlib] Apply review notes from @glessard (thanks!)
1 parent c7abaf0 commit c821c2f

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

stdlib/public/core/UnsafePointer.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ extension UnsafePointer {
302302
extension UnsafePointer where Pointee: ~Copyable {
303303
/// Accesses the pointee at the specified offset from this pointer.
304304
///
305-
///
306305
/// For a pointer `p`, the memory at `p + i` must be initialized.
307306
///
308307
/// - Parameter i: The offset from this pointer at which to access an

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ extension Unsafe${Mutable}RawBufferPointer: Sequence {
192192
///
193193
/// - Returns: an iterator over any remaining elements of `self` and the
194194
/// number of elements copied.
195-
@inlinable // unsafe-performance
196195
@_alwaysEmitIntoClient
197196
public func _copyContents(
198197
initializing destination: UnsafeMutableBufferPointer<UInt8>
@@ -406,7 +405,7 @@ extension Unsafe${Mutable}RawBufferPointer {
406405
return baseAddress!.load(fromByteOffset: offset, as: T.self)
407406
}
408407

409-
// FIXME(NCG): Add a consuming analogue of `load`, like `move(fromByteOffset:as:_:)`
408+
// FIXME(NCG): Add a consuming analogue of `load`, like `move(fromByteOffset:as:_:)` (in the mutable variant)
410409
// FIXME(NCG): Add a borrow analogue of `load`, like `withBorrow(fromByteOffset:as:_:)`
411410

412411
/// Returns a new instance of the given type, constructed from the raw memory
@@ -498,7 +497,6 @@ extension Unsafe${Mutable}RawBufferPointer {
498497
/// - type: The type to use for the newly constructed instance. The memory
499498
/// must be initialized to a value of a type that is layout compatible
500499
/// with `type`.
501-
@inlinable
502500
@_alwaysEmitIntoClient
503501
// This custom silgen name is chosen to not interfere with the old ABI
504502
@_silgen_name("_swift_se0349_UnsafeMutableRawBufferPointer_storeBytes")
@@ -853,7 +851,6 @@ extension Unsafe${Mutable}RawBufferPointer {
853851
/// - Returns: A typed buffer referencing the initialized elements.
854852
/// The returned buffer references memory starting at the same
855853
/// base address as this buffer, and its count is equal to `source.count`
856-
@inlinable
857854
@_alwaysEmitIntoClient
858855
public func initializeMemory<C: Collection>(
859856
as type: C.Element.Type,
@@ -942,7 +939,6 @@ extension Unsafe${Mutable}RawBufferPointer {
942939
/// The returned buffer references memory starting at the same
943940
/// base address as this buffer, and its count is equal to `source.count`.
944941
@discardableResult
945-
@inlinable
946942
@_alwaysEmitIntoClient
947943
public func moveInitializeMemory<T: ~Copyable>(
948944
as type: T.Type,
@@ -1085,9 +1081,8 @@ extension Unsafe${Mutable}RawBufferPointer {
10851081
/// the return value for the `withMemoryRebound(to:capacity:_:)` method.
10861082
/// - buffer: The buffer temporarily bound to instances of `T`.
10871083
/// - Returns: The return value, if any, of the `body` closure parameter.
1088-
@inlinable
10891084
@_alwaysEmitIntoClient
1090-
public func withMemoryRebound<T: ~Copyable, Result: ~Copyable, E: Error>(
1085+
public func withMemoryRebound<T: ~Copyable, E: Error, Result: ~Copyable>(
10911086
to type: T.Type,
10921087
_ body: (_ buffer: Unsafe${Mutable}BufferPointer<T>) throws(E) -> Result
10931088
) throws(E) -> Result {
@@ -1123,7 +1118,6 @@ extension Unsafe${Mutable}RawBufferPointer {
11231118
///
11241119
/// - Parameter to: The type `T` that the memory has already been bound to.
11251120
/// - Returns: A typed pointer to the same memory as this raw pointer.
1126-
@inlinable
11271121
@_alwaysEmitIntoClient
11281122
public func assumingMemoryBound<T: ~Copyable>(
11291123
to: T.Type
@@ -1139,9 +1133,8 @@ extension Unsafe${Mutable}RawBufferPointer {
11391133
}
11401134

11411135
% if Mutable:
1142-
@inlinable
11431136
@_alwaysEmitIntoClient
1144-
public func withContiguousMutableStorageIfAvailable<R: ~Copyable>(
1137+
public func withContiguousMutableStorageIfAvailable<R>(
11451138
_ body: (inout UnsafeMutableBufferPointer<Element>) throws -> R
11461139
) rethrows -> R? {
11471140
#if $TypedThrows
@@ -1161,9 +1154,8 @@ extension Unsafe${Mutable}RawBufferPointer {
11611154
}
11621155

11631156
% end
1164-
@inlinable
11651157
@_alwaysEmitIntoClient
1166-
public func withContiguousStorageIfAvailable<R: ~Copyable>(
1158+
public func withContiguousStorageIfAvailable<R>(
11671159
_ body: (UnsafeBufferPointer<Element>) throws -> R
11681160
) rethrows -> R? {
11691161
#if $TypedThrows

stdlib/public/core/UnsafeRawPointer.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ extension UnsafeRawPointer {
385385
/// - pointer: The pointer temporarily bound to `T`.
386386
/// - Returns: The return value, if any, of the `body` closure parameter.
387387
@_alwaysEmitIntoClient
388-
public func withMemoryRebound<T: ~Copyable, Result: ~Copyable, E: Error>(
388+
public func withMemoryRebound<T: ~Copyable, E: Error, Result: ~Copyable>(
389389
to type: T.Type,
390390
capacity count: Int,
391391
_ body: (_ pointer: UnsafePointer<T>) throws(E) -> Result
@@ -453,7 +453,6 @@ extension UnsafeRawPointer {
453453
#endif
454454
}
455455

456-
// FIXME(NCG): Add a consuming analogue of `load`, like `move(fromByteOffset:as:_:)`
457456
// FIXME(NCG): Add a borrow analogue of `load`, like `withBorrow(fromByteOffset:as:_:)`
458457

459458
#if $BitwiseCopyable
@@ -996,7 +995,7 @@ extension UnsafeMutableRawPointer {
996995
/// - pointer: The pointer temporarily bound to `T`.
997996
/// - Returns: The return value, if any, of the `body` closure parameter.
998997
@_alwaysEmitIntoClient
999-
public func withMemoryRebound<T: ~Copyable, Result: ~Copyable, E: Error>(
998+
public func withMemoryRebound<T: ~Copyable, E: Error, Result: ~Copyable>(
1000999
to type: T.Type,
10011000
capacity count: Int,
10021001
_ body: (_ pointer: UnsafeMutablePointer<T>) throws(E) -> Result

0 commit comments

Comments
 (0)