Include notes about index mutation in span(after/before:)

The indexes passed to span(after:) and friends on UniqueArray
and RigidArray are modified before return. This adds notes
about the updated values to the method documentation, along
with a few other minor formatting changes (dropping smart
quotes, single-sentence abstracts).
This commit is contained in:
Nate Cook authored and Karoy Lorentey committed 2026-03-02 16:38:48 -08:00
1 parent aa337b4caf
commit 54ca53612f
28 files changed
+143 -109

No files matched your search

@@ -20,7 +20,7 @@ import ContainersPreview
@available(SwiftStdlib 5.0, *)
extension UniqueArray: BorrowingSequence where Element: ~Copyable {
public typealias BorrowingIterator = RigidArray<Element>.BorrowingIterator
public var estimatedCount: EstimatedCount {
.exactly(count)
}
@@ -62,7 +62,7 @@ extension UniqueArray where Element: ~Copyable {
/// start.
///
/// Valid indices consist of the position of every element and a "past the
/// end” position that’s not valid for use as a subscript argument.
/// end" position that's not valid for use as a subscript argument.
public typealias Index = Int
/// The position of the first element in a nonempty array. This is always zero.
@@ -72,7 +72,7 @@ extension UniqueArray where Element: ~Copyable {
@inline(__always)
public var startIndex: Int { _storage.startIndex }
/// The array’s "past the end” position—that is, the position one greater than
/// The array's "past the end" position—that is, the position one greater than
/// the last valid subscript argument. This is always equal to array's count.
///
/// - Complexity: O(1)
@@ -141,7 +141,7 @@ extension UniqueArray where Element: ~Copyable {
@_alwaysEmitIntoClient
@inline(__always)
public func index(after index: Int) -> Int { index + 1 }
/// Returns the position immediately before the given index.
///
/// - Note: To improve performance, this method does not validate that the
@@ -207,7 +207,7 @@ extension UniqueArray where Element: ~Copyable {
public func index(_ index: Int, offsetBy n: Int) -> Int {
index + n
}
/// Returns the distance between two indices.
///
/// - Note: To improve performance, this method does not validate that the
@@ -225,7 +225,7 @@ extension UniqueArray where Element: ~Copyable {
public func distance(from start: Index, to end: Index) -> Int {
end - start
}
/// Offsets the given index by the specified distance, but no further than
/// the given limiting index.
///