Skip to content

Commit 5bc723d

Browse files
committed
[stdlib] Adjust lifetime declarations
1 parent 192b404 commit 5bc723d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

stdlib/public/core/Optional.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ extension Optional where Wrapped: ~Copyable & ~Escapable {
180180
/// Creates an instance that stores the given value.
181181
@_transparent
182182
@_alwaysEmitIntoClient
183-
@lifetime(value)
183+
@lifetime(copy value)
184184
public init(_ value: consuming Wrapped) {
185185
// FIXME: Merge this into the original entry above.
186186
self = .some(value)
@@ -445,7 +445,7 @@ extension Optional where Wrapped: ~Copyable & ~Escapable {
445445
/// - Returns: The wrapped value being stored in this instance. If this
446446
/// instance is `nil`, returns `nil`.
447447
@_alwaysEmitIntoClient
448-
@lifetime(self)
448+
@lifetime(copy self)
449449
public mutating func take() -> Self {
450450
let result = consume self
451451
self = nil

stdlib/public/core/Result.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ extension Result where Success: ~Copyable & ~Escapable {
311311
/// - Returns: The success value, if the instance represents a success.
312312
/// - Throws: The failure value, if the instance represents a failure.
313313
@_alwaysEmitIntoClient
314+
@lifetime(copy self)
314315
public consuming func get() throws(Failure) -> Success {
315316
switch consume self {
316317
case let .success(success):

0 commit comments

Comments
 (0)