Skip to content

Commit c6116be

Browse files
committed
Update stdlib source with explicit @Lifetime(copy self)
1 parent 411a65b commit c6116be

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

stdlib/public/core/LifetimeManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ internal func _overrideLifetime<
287287
@_unsafeNonescapableResult
288288
@_alwaysEmitIntoClient
289289
@_transparent
290-
@lifetime(source)
290+
@lifetime(copy source)
291291
internal func _overrideLifetime<
292292
T: ~Copyable & ~Escapable, U: ~Copyable & ~Escapable
293293
>(

stdlib/public/core/Span/RawSpan.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ extension RawSpan {
364364
///
365365
/// - Complexity: O(1)
366366
@_alwaysEmitIntoClient
367-
@lifetime(self)
367+
@lifetime(copy self)
368368
public func _extracting(_ bounds: Range<Int>) -> Self {
369369
_precondition(
370370
UInt(bitPattern: bounds.lowerBound) <= UInt(bitPattern: _count) &&
@@ -391,7 +391,7 @@ extension RawSpan {
391391
/// - Complexity: O(1)
392392
@unsafe
393393
@_alwaysEmitIntoClient
394-
@lifetime(self)
394+
@lifetime(copy self)
395395
public func _extracting(unchecked bounds: Range<Int>) -> Self {
396396
let newStart = unsafe _pointer?.advanced(by: bounds.lowerBound)
397397
let newSpan = unsafe RawSpan(_unchecked: newStart, byteCount: bounds.count)
@@ -412,7 +412,7 @@ extension RawSpan {
412412
///
413413
/// - Complexity: O(1)
414414
@_alwaysEmitIntoClient
415-
@lifetime(self)
415+
@lifetime(copy self)
416416
public func _extracting(_ bounds: some RangeExpression<Int>) -> Self {
417417
_extracting(bounds.relative(to: byteOffsets))
418418
}
@@ -434,7 +434,7 @@ extension RawSpan {
434434
/// - Complexity: O(1)
435435
@unsafe
436436
@_alwaysEmitIntoClient
437-
@lifetime(self)
437+
@lifetime(copy self)
438438
public func _extracting(
439439
unchecked bounds: ClosedRange<Int>
440440
) -> Self {
@@ -454,7 +454,7 @@ extension RawSpan {
454454
///
455455
/// - Complexity: O(1)
456456
@_alwaysEmitIntoClient
457-
@lifetime(self)
457+
@lifetime(copy self)
458458
public func _extracting(_: UnboundedRange) -> Self {
459459
self
460460
}
@@ -509,7 +509,7 @@ extension RawSpan {
509509
/// - Returns: A typed span viewing these bytes as instances of `T`.
510510
@unsafe
511511
@_alwaysEmitIntoClient
512-
@lifetime(self)
512+
@lifetime(copy self)
513513
consuming public func _unsafeView<T: BitwiseCopyable>(
514514
as type: T.Type
515515
) -> Span<T> {
@@ -689,7 +689,7 @@ extension RawSpan {
689689
///
690690
/// - Complexity: O(1)
691691
@_alwaysEmitIntoClient
692-
@lifetime(self)
692+
@lifetime(copy self)
693693
public func _extracting(first maxLength: Int) -> Self {
694694
_precondition(maxLength >= 0, "Can't have a prefix of negative length")
695695
let newCount = min(maxLength, byteCount)
@@ -711,7 +711,7 @@ extension RawSpan {
711711
///
712712
/// - Complexity: O(1)
713713
@_alwaysEmitIntoClient
714-
@lifetime(self)
714+
@lifetime(copy self)
715715
public func _extracting(droppingLast k: Int) -> Self {
716716
_precondition(k >= 0, "Can't drop a negative number of bytes")
717717
let droppedCount = min(k, byteCount)
@@ -735,7 +735,7 @@ extension RawSpan {
735735
///
736736
/// - Complexity: O(1)
737737
@_alwaysEmitIntoClient
738-
@lifetime(self)
738+
@lifetime(copy self)
739739
public func _extracting(last maxLength: Int) -> Self {
740740
_precondition(maxLength >= 0, "Can't have a suffix of negative length")
741741
let newCount = min(maxLength, byteCount)
@@ -761,7 +761,7 @@ extension RawSpan {
761761
///
762762
/// - Complexity: O(1)
763763
@_alwaysEmitIntoClient
764-
@lifetime(self)
764+
@lifetime(copy self)
765765
public func _extracting(droppingFirst k: Int) -> Self {
766766
_precondition(k >= 0, "Can't drop a negative number of bytes")
767767
let droppedCount = min(k, byteCount)

stdlib/public/core/Span/Span.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ extension Span where Element: BitwiseCopyable {
358358
/// - bytes: An existing `RawSpan`, which will define both this
359359
/// `Span`'s lifetime and the memory it represents.
360360
@_alwaysEmitIntoClient
361-
@lifetime(bytes)
361+
@lifetime(copy bytes)
362362
public init(_bytes bytes: consuming RawSpan) {
363363
let rawBuffer = unsafe UnsafeRawBufferPointer(
364364
start: bytes._pointer, count: bytes.byteCount
@@ -509,7 +509,7 @@ extension Span where Element: ~Copyable {
509509
///
510510
/// - Complexity: O(1)
511511
@_alwaysEmitIntoClient
512-
@lifetime(self)
512+
@lifetime(copy self)
513513
public func _extracting(_ bounds: Range<Index>) -> Self {
514514
_precondition(
515515
UInt(bitPattern: bounds.lowerBound) <= UInt(bitPattern: _count) &&
@@ -536,7 +536,7 @@ extension Span where Element: ~Copyable {
536536
/// - Complexity: O(1)
537537
@unsafe
538538
@_alwaysEmitIntoClient
539-
@lifetime(self)
539+
@lifetime(copy self)
540540
public func _extracting(unchecked bounds: Range<Index>) -> Self {
541541
let delta = bounds.lowerBound &* MemoryLayout<Element>.stride
542542
let newStart = unsafe _pointer?.advanced(by: delta)
@@ -560,7 +560,7 @@ extension Span where Element: ~Copyable {
560560
///
561561
/// - Complexity: O(1)
562562
@_alwaysEmitIntoClient
563-
@lifetime(self)
563+
@lifetime(copy self)
564564
public func _extracting(
565565
_ bounds: some RangeExpression<Index>
566566
) -> Self {
@@ -584,7 +584,7 @@ extension Span where Element: ~Copyable {
584584
/// - Complexity: O(1)
585585
@unsafe
586586
@_alwaysEmitIntoClient
587-
@lifetime(self)
587+
@lifetime(copy self)
588588
public func _extracting(
589589
unchecked bounds: ClosedRange<Index>
590590
) -> Self {
@@ -604,7 +604,7 @@ extension Span where Element: ~Copyable {
604604
///
605605
/// - Complexity: O(1)
606606
@_alwaysEmitIntoClient
607-
@lifetime(self)
607+
@lifetime(copy self)
608608
public func _extracting(_: UnboundedRange) -> Self {
609609
self
610610
}
@@ -730,7 +730,7 @@ extension Span where Element: ~Copyable {
730730
///
731731
/// - Complexity: O(1)
732732
@_alwaysEmitIntoClient
733-
@lifetime(self)
733+
@lifetime(copy self)
734734
public func _extracting(first maxLength: Int) -> Self {
735735
_precondition(maxLength >= 0, "Can't have a prefix of negative length")
736736
let newCount = min(maxLength, count)
@@ -752,7 +752,7 @@ extension Span where Element: ~Copyable {
752752
///
753753
/// - Complexity: O(1)
754754
@_alwaysEmitIntoClient
755-
@lifetime(self)
755+
@lifetime(copy self)
756756
public func _extracting(droppingLast k: Int) -> Self {
757757
_precondition(k >= 0, "Can't drop a negative number of elements")
758758
let droppedCount = min(k, count)
@@ -775,7 +775,7 @@ extension Span where Element: ~Copyable {
775775
///
776776
/// - Complexity: O(1)
777777
@_alwaysEmitIntoClient
778-
@lifetime(self)
778+
@lifetime(copy self)
779779
public func _extracting(last maxLength: Int) -> Self {
780780
_precondition(maxLength >= 0, "Can't have a suffix of negative length")
781781
let newCount = min(maxLength, count)
@@ -802,7 +802,7 @@ extension Span where Element: ~Copyable {
802802
///
803803
/// - Complexity: O(1)
804804
@_alwaysEmitIntoClient
805-
@lifetime(self)
805+
@lifetime(copy self)
806806
public func _extracting(droppingFirst k: Int) -> Self {
807807
_precondition(k >= 0, "Can't drop a negative number of elements")
808808
let droppedCount = min(k, count)

0 commit comments

Comments
 (0)