Skip to content

Commit b17a8d4

Browse files
committed
Generalize Optional._consumingUncheckedUnwrapped()
This is just to round things out — this internal function was sticking out from the public interfaces. No stdlib code needs this generalization yet, but I see no reason to delay it.
1 parent dc5e9f5 commit b17a8d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/public/core/Optional.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,13 @@ extension Optional where Wrapped: ~Escapable {
395395
}
396396
}
397397

398-
extension Optional where Wrapped: ~Copyable {
398+
extension Optional where Wrapped: ~Copyable & ~Escapable {
399399
/// - Returns: `unsafelyUnwrapped`.
400400
///
401401
/// This version is for internal stdlib use; it avoids any checking
402402
/// overhead for users, even in Debug builds.
403403
@_alwaysEmitIntoClient
404+
@lifetime(copy self)
404405
internal consuming func _consumingUncheckedUnwrapped() -> Wrapped {
405406
if let x = self {
406407
return x

0 commit comments

Comments
 (0)