File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -769,15 +769,15 @@ extension Unsafe${Mutable}BufferPointer {
769
769
from source: S
770
770
) - > ( unwritten: S . Iterator, index: Index) where S. Element == Element {
771
771
var iterator = source. makeIterator ( )
772
- guard var pointer = baseAddress else { return ( iterator, startIndex) }
773
- for index in indices {
774
- guard let element = iterator . next ( ) else {
775
- return ( iterator , index )
776
- }
777
- pointer . pointee = element
778
- pointer += 1
772
+ guard ! self . isEmpty else { return ( iterator, startIndex) }
773
+ _internalInvariant ( _position != nil )
774
+ var index = startIndex
775
+ while index < endIndex {
776
+ guard let element = iterator . next ( ) else { break }
777
+ _position . _unsafelyUnwrappedUnchecked [ index ] = element
778
+ formIndex ( after : & index )
779
779
}
780
- return ( iterator, endIndex )
780
+ return ( iterator, index )
781
781
}
782
782
783
783
/// Updates the buffer's initialized memory with every element of the source.
You can’t perform that action at this time.
0 commit comments