File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,20 @@ func _rethrowsViaClosure(_ fn: () throws -> ()) rethrows {
239239/// Extensions to the `Copyable` protocol are not allowed.
240240@_marker public protocol Copyable /*: ~Escapable*/ { }
241241
242- @_documentation ( visibility: internal)
242+ /// A type whose values can persist beyond their immediate local scope.
243+ ///
244+ /// Escapable values can be assigned to global or static variables, returned from functions, captured by escaping
245+ /// closures, and so on. All Swift types implicitly conform to this protocol by default, allowing them to be moved across
246+ /// scopes freely because they lack any lifetime dependencies.
247+ ///
248+ /// In contrast, values of types that suppress their implicit conformance to `Escapable` (by writing `~Escapable`)
249+ /// carry a lifetime dependency. These dependencies ensure the `~Escapable` value does not live longer than the value it
250+ /// depends on. Explicit lifetime dependency annotations may be required when working with these types.
251+ ///
252+ /// In generic contexts, `~Escapable` works much in the same way as `~Copyable`. It allows functions and types to work
253+ /// with values that may or may not be Escapable, and types can be conditionally `Escapable` based on their generic
254+ /// arguments. A conformance requirement for `Escapable` is automatically inferred in extensions and for generic type
255+ /// parameters, unless suppressed with `~Escapable`.
243256@_marker public protocol Escapable /*: ~Copyable*/ { }
244257
245258@_marker public protocol BitwiseCopyable : ~ Escapable { }
You can’t perform that action at this time.
0 commit comments