Skip to content

Commit 84b6395

Browse files
committed
[stdlib] Generalize Optional’s “some” initializer
1 parent 4ff38db commit 84b6395

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/public/core/Optional.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ extension Optional: Sendable where Wrapped: ~Copyable & ~Escapable & Sendable {}
147147

148148

149149
@_preInverseGenerics
150-
extension Optional: ExpressibleByNilLiteral where Wrapped: ~Copyable & ~Escapable {
150+
extension Optional: ExpressibleByNilLiteral
151+
where Wrapped: ~Copyable & ~Escapable {
151152
/// Creates an instance initialized with `nil`.
152153
///
153154
/// Do not call this initializer directly. It is used by the compiler when you
@@ -165,10 +166,11 @@ extension Optional: ExpressibleByNilLiteral where Wrapped: ~Copyable & ~Escapabl
165166
}
166167
}
167168

168-
extension Optional where Wrapped: ~Copyable & Escapable {
169+
extension Optional where Wrapped: ~Copyable & ~Escapable {
169170
/// Creates an instance that stores the given value.
170171
@_transparent
171172
@_preInverseGenerics
173+
@lifetime(some)
172174
public init(_ some: consuming Wrapped) { self = .some(some) }
173175
}
174176

0 commit comments

Comments
 (0)