@@ -405,7 +405,7 @@ extension Optional where Wrapped: ~Copyable {
405
405
}
406
406
}
407
407
408
- extension Optional where Wrapped: ~ Copyable {
408
+ extension Optional where Wrapped: ~ Copyable & ~ Escapable {
409
409
/// Takes the wrapped value being stored in this instance and returns it while
410
410
/// also setting the instance to `nil`. If there is no value being stored in
411
411
/// this instance, this returns `nil` instead.
@@ -423,6 +423,7 @@ extension Optional where Wrapped: ~Copyable {
423
423
/// - Returns: The wrapped value being stored in this instance. If this
424
424
/// instance is `nil`, returns `nil`.
425
425
@_alwaysEmitIntoClient
426
+ @lifetime ( self )
426
427
public mutating func take( ) -> Self {
427
428
let result = consume self
428
429
self = nil
@@ -583,7 +584,7 @@ public struct _OptionalNilComparisonType: ExpressibleByNilLiteral {
583
584
}
584
585
}
585
586
586
- extension Optional where Wrapped: ~ Copyable {
587
+ extension Optional where Wrapped: ~ Copyable & ~ Escapable {
587
588
/// Returns a Boolean value indicating whether an argument matches `nil`.
588
589
///
589
590
/// You can use the pattern-matching operator (`~=`) to test whether an
@@ -806,7 +807,8 @@ extension Optional where Wrapped: ~Copyable {
806
807
/// type as the `Wrapped` type of `optional`.
807
808
@_transparent
808
809
@_alwaysEmitIntoClient
809
- public func ?? < T: ~ Copyable> (
810
+ @lifetime ( optional)
811
+ public func ?? < T: ~ Copyable & ~ Escapable> (
810
812
optional: consuming T ? ,
811
813
defaultValue: @autoclosure ( ) throws -> T // FIXME: typed throw
812
814
) rethrows -> T {
@@ -877,8 +879,9 @@ internal func _legacy_abi_optionalNilCoalescingOperator <T>(
877
879
/// `optional` have the same type.
878
880
@_transparent
879
881
@_alwaysEmitIntoClient
882
+ @lifetime ( optional)
880
883
// FIXME: This needs to support typed throws.
881
- public func ?? < T: ~ Copyable> (
884
+ public func ?? < T: ~ Copyable & ~ Escapable > (
882
885
optional: consuming T ? ,
883
886
defaultValue: @autoclosure ( ) throws -> T ?
884
887
) rethrows -> T ? {
0 commit comments