Skip to content

Commit e3f3cd8

Browse files
committed
[stdlib] adjust failure messages (and spellings)
1 parent d05b334 commit e3f3cd8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stdlib/public/core/Span/RawSpan.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ extension RawSpan {
683683
@_alwaysEmitIntoClient
684684
@lifetime(self)
685685
public func _extracting(droppingLast k: Int) -> Self {
686-
_precondition(k >= 0, "Can't drop a negative number of elements")
686+
_precondition(k >= 0, "Can't drop a negative number of bytes")
687687
let droppedCount = min(k, byteCount)
688688
return Self(_unchecked: _pointer, byteCount: byteCount &- droppedCount)
689689
}
@@ -709,7 +709,7 @@ extension RawSpan {
709709
_precondition(maxLength >= 0, "Can't have a suffix of negative length")
710710
let newCount = min(maxLength, byteCount)
711711
let newStart = unsafe _pointer?.advanced(by: byteCount &- newCount)
712-
let newSpan = RawSpan(_unchecked: newStart, byteCount: newCount)
712+
let newSpan = Self(_unchecked: newStart, byteCount: newCount)
713713
// As a trivial value, 'newStart' does not formally depend on the
714714
// lifetime of 'self'. Make the dependence explicit.
715715
return unsafe _overrideLifetime(newSpan, copying: self)
@@ -732,10 +732,10 @@ extension RawSpan {
732732
@_alwaysEmitIntoClient
733733
@lifetime(self)
734734
public func _extracting(droppingFirst k: Int) -> Self {
735-
_precondition(k >= 0, "Can't drop a negative number of elements")
736-
let droppedCount = min(k, byteCount)
737-
let newStart = unsafe _pointer?.advanced(by: droppedCount)
738-
let newSpan = RawSpan(_unchecked: newStart, byteCount: byteCount &- droppedCount)
735+
_precondition(k >= 0, "Can't drop a negative number of bytes")
736+
let dropped = min(k, byteCount)
737+
let newStart = unsafe _pointer?.advanced(by: dropped)
738+
let newSpan = Self(_unchecked: newStart, byteCount: byteCount &- dropped)
739739
// As a trivial value, 'newStart' does not formally depend on the
740740
// lifetime of 'self'. Make the dependence explicit.
741741
return unsafe _overrideLifetime(newSpan, copying: self)

0 commit comments

Comments
 (0)