Skip to content

Commit 488f5c7

Browse files
authored
SE-0458: Replace "Element" with "Index" in the swapAt signature (#2662)
1 parent 8767f69 commit 488f5c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

proposals/0458-strict-memory-safety.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ The operation `UnsafeMutableBufferPointer.swapAt` swaps the values at the given
122122

123123
```swift
124124
extension UnsafeMutableBufferPointer {
125-
@unsafe public func swapAt(_ i: Element, _ j: Element) {
125+
@unsafe public func swapAt(_ i: Index, _ j: Index) {
126126
guard i != j else { return }
127127
precondition(i >= 0 && j >= 0)
128128
precondition(unsafe i < endIndex && j < endIndex)
@@ -476,7 +476,7 @@ A function marked `@unsafe` is unsafe to use, so any clients that have enabled s
476476

477477
```swift
478478
extension UnsafeMutableBufferPointer {
479-
@unsafe public func swapAt(_ i: Element, _ j: Element) {
479+
@unsafe public func swapAt(_ i: Index, _ j: Index) {
480480
guard i != j else { return }
481481
precondition(i >= 0 && j >= 0)
482482
precondition(unsafe i < endIndex && j < endIndex)
@@ -493,7 +493,7 @@ We could choose to make `@unsafe` on a function acknowledge all uses of unsafe c
493493

494494
```swift
495495
extension UnsafeMutableBufferPointer {
496-
@unsafe public func swapAt(_ i: Element, _ j: Element) {
496+
@unsafe public func swapAt(_ i: Index, _ j: Index) {
497497
guard i != j else { return }
498498
precondition(i >= 0 && j >= 0)
499499
precondition(i < endIndex && j < endIndex)
@@ -552,7 +552,7 @@ The `unsafe` expression proposed here covers unsafe constructs within a single
552552

553553
```swift
554554
extension UnsafeMutableBufferPointer {
555-
@unsafe public func swapAt(_ i: Element, _ j: Element) {
555+
@unsafe public func swapAt(_ i: Index, _ j: Index) {
556556
guard i != j else { return }
557557
precondition(i >= 0 && j >= 0)
558558
precondition(i < endIndex && j < endIndex)

0 commit comments

Comments
 (0)