Skip to content

Commit f5ffe09

Browse files
committed
[se-0370] fix editing errors
1 parent 3e22d3a commit f5ffe09

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

stdlib/public/core/UnsafeBufferPointer.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ extension Unsafe${Mutable}BufferPointer {
763763
@_alwaysEmitIntoClient
764764
public func update<S: Sequence>(
765765
from source: S
766-
) -> (unwritten: S.Iterator, updated: Index) where S.Element == Element {
766+
) -> (unwritten: S.Iterator, index: Index) where S.Element == Element {
767767
var iterator = source.makeIterator()
768768
guard var pointer = baseAddress else { return (iterator, startIndex) }
769769
for index in indices {

stdlib/public/core/UnsafeBufferPointerSlice.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ extension Slice where Base == UnsafeMutableRawBufferPointer {
156156
/// - Returns: A typed buffer referencing the initialized elements.
157157
/// The returned buffer references memory starting at the same
158158
/// base address as this slice, and its count is equal to `source.count`.
159+
@discardableResult
159160
@inlinable
160161
@_alwaysEmitIntoClient
161162
public func moveInitializeMemory<T>(
@@ -193,6 +194,7 @@ extension Slice where Base == UnsafeMutableRawBufferPointer {
193194
/// - Returns: A typed buffer referencing the initialized elements.
194195
/// The returned buffer references memory starting at the same
195196
/// base address as this slice, and its count is equal to `source.count`.
197+
@discardableResult
196198
@inlinable
197199
@_alwaysEmitIntoClient
198200
public func moveInitializeMemory<T>(
@@ -720,7 +722,7 @@ extension Slice {
720722
@_alwaysEmitIntoClient
721723
public func initialize<S>(
722724
from source: S
723-
) -> (S.Iterator, Index)
725+
) -> (unwritten: S.Iterator, index: Index)
724726
where S: Sequence, Base == UnsafeMutableBufferPointer<S.Element> {
725727
let buffer = Base(rebasing: self)
726728
let (iterator, index) = buffer.initialize(from: source)
@@ -743,10 +745,12 @@ extension Slice {
743745
/// as the buffer slice can hold, the returned index is equal to
744746
/// to the slice's `endIndex`.
745747
///
748+
/// - Precondition: `self.count` >= `source.count`
749+
///
746750
/// - Parameter source: A collection of elements to be used to
747751
/// initialize the buffer's storage.
748752
/// - Returns: An index to the next uninitialized element in the
749-
/// buffer slice, or `endIndex`. @discardableResult
753+
/// buffer slice, or `endIndex`.
750754
@inlinable
751755
@_alwaysEmitIntoClient
752756
public func initialize<C>(
@@ -788,7 +792,7 @@ extension Slice {
788792
@_alwaysEmitIntoClient
789793
public func update<S>(
790794
from source: S
791-
) -> (unwritten: S.Iterator, updated: Index)
795+
) -> (unwritten: S.Iterator, index: Index)
792796
where S: Sequence, Base == UnsafeMutableBufferPointer<S.Element> {
793797
let buffer = Base(rebasing: self)
794798
let (iterator, index) = buffer.update(from: source)

stdlib/public/core/UnsafeRawBufferPointer.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ extension Unsafe${Mutable}RawBufferPointer {
863863
/// - Returns: A typed buffer referencing the initialized elements.
864864
/// The returned buffer references memory starting at the same
865865
/// base address as this buffer, and its count is equal to `source.count`.
866+
@discardableResult
866867
@inlinable
867868
@_alwaysEmitIntoClient
868869
public func moveInitializeMemory<T>(

0 commit comments

Comments
 (0)