Skip to content

Commit b15d39a

Browse files
committed
more typos
1 parent 5340db1 commit b15d39a

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

proposals/nnnn-MutableSpan.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,12 @@ This function returns an instance of `MutableSpan` that represents a mutation of
9696
var array = [1, 2, 3, 4, 5]
9797
var span1 = array.mutableSpan
9898
var span2 = span1.extracting(3..<5)
99-
// span1 cannot be accessed here
99+
// neither array nor span1 can be accessed here
100100
span2.swapAt(0, 1)
101101
_ = consume span2 // explicitly end scope for `span2`
102-
print(array) // [1, 2, 3, 5, 4]
102+
span1.swapAt(0, 1)
103+
_ = consume span1 // explicitly end scope for `span1`
104+
print(array) // [2, 1, 3, 5, 4]
103105
```
104106

105107
As established in [SE-0437][SE-0437], the instance returned by the `extracting()` function does not share indices with the function's callee.
@@ -169,7 +171,7 @@ for i in myMutableSpan.indices {
169171
We include functions to perform bulk copies of elements into the memory represented by a `MutableSpan`. Updating a `MutableSpan` from known-sized sources (such as `Collection` or `Span`) copies every element of a source. It is an error to do so when there is the span is too short to contain every element from the source. Updating a `MutableSpan` from `Sequence` or `IteratorProtocol` instances will copy as many items as possible, either until the input is empty or until the operation has updated the item at the last index. The bulk operations return the index following the last element updated.
170172

171173
```swift
172-
extension MutableSpan where Element: Copyable{
174+
extension MutableSpan where Element: Copyable {
173175
/// Updates every element of this span's to the given value.
174176
mutating func update(
175177
repeating repeatedValue: Element
@@ -179,12 +181,12 @@ extension MutableSpan where Element: Copyable{
179181
mutating func update<S: Sequence>(
180182
from source: S
181183
) -> (unwritten: S.Iterator, index: Index) where S.Element == Element
182-
184+
183185
/// Updates the span's elements with the elements from the source
184186
mutating func update(
185187
from source: inout some IteratorProtocol<Element>
186188
) -> Index
187-
189+
188190
/// Updates the span's elements with every element of the source.
189191
mutating func update(
190192
fromContentsOf source: some Collection<Element>
@@ -196,7 +198,7 @@ extension MutableSpan where Element: ~Copyable
196198
mutating func update(
197199
fromContentsOf source: Span<Element>
198200
) -> Index
199-
201+
200202
/// Updates the span's elements with every element of the source.
201203
mutating func update(
202204
fromContentsOf source: borrowing MutableSpan<Element>
@@ -245,7 +247,7 @@ extension MutableSpan where Element: ~Copable & ~Escapable {
245247
/// Returns a span containing the final elements of the span,
246248
/// up to the given maximum length.
247249
@_lifetime(inout self)
248-
mutating public func extracting(last maxLegnth: Int) -> Self
250+
mutating public func extracting(last maxLength: Int) -> Self
249251

250252
/// Returns a span over all but the given number of initial elements.
251253
@_lifetime(inout self)
@@ -292,8 +294,7 @@ extension MutableSpan where Element: ~Copyable {
292294
}
293295
```
294296

295-
296-
##### Interoperability with unsafe code:
297+
##### Interoperability with unsafe code
297298

298299
```swift
299300
extension MutableSpan where Element: ~Copyable {
@@ -457,6 +458,7 @@ extension MutableRawSpan {
457458
```
458459

459460
##### Extracting sub-spans
461+
460462
These functions extract sub-spans of the callee. The first two perform strict bounds-checking. The last four return prefixes or suffixes, where the number of elements in the returned sub-span is bounded by the number of elements in the parent `MutableRawSpan`.
461463

462464
```swift
@@ -513,8 +515,6 @@ extension MutableRawSpan {
513515
}
514516
```
515517

516-
517-
518518
##### Interoperability with unsafe code:
519519

520520
```swift
@@ -697,11 +697,11 @@ It is desirable to have a way to split a `MutableSpan` in multiple parts, for di
697697

698698
```swift
699699
extension MutableSpan where Element: ~Copyable {
700-
func split(at index: Index) -> (part1: Self, part2: Self)
700+
public mutating func split(at index: Index) -> (part1: Self, part2: Self)
701701
}
702702
```
703703

704-
Unfortunately, tuples do not support non-copyable values yet. We may be able to use `InlineArray` ([SE-0453][SE-0453]), or a bespoke type, but destructuring the non-copyable constituent part remains a challenge. Solving this issue for `Span` and `MutableSpan` is a top priority.
704+
Unfortunately, tuples do not support non-copyable or non-escapable values yet. We may be able to use `InlineArray` ([SE-0453][SE-0453]), or a bespoke type, but destructuring the non-copyable constituent part remains a challenge. Solving this issue for `Span` and `MutableSpan` is a top priority.
705705

706706
#### Mutating algorithms
707707

0 commit comments

Comments
 (0)