@@ -169,6 +169,54 @@ func _rethrowsViaClosure(_ fn: () throws -> ()) rethrows {
169
169
try fn ( )
170
170
}
171
171
172
+ /// A type whose values can be implicitly or explicitly copied.
173
+ ///
174
+ /// XXX this protocol has no symbol requirements, but it does have semantic requirements
175
+ ///
176
+ /// Conformance to the `Copyable` protocol
177
+ /// is implicitly included in the following places:
178
+ ///
179
+ /// * Structures declarations
180
+ /// * Enumerations declarations
181
+ /// * Class declarations
182
+ /// * Protocol declarations
183
+ /// * Associated type declarations
184
+ /// * The `Self` type in a protocol extension
185
+ ///
186
+ /// In a declaration that includes generic type parameters,
187
+ /// each generic type parameter implicitly includes `Copyable`
188
+ /// in its list of requirements.
189
+ /// Metatypes and tuples of copyable types are also implicitly copyable.
190
+ /// For example,
191
+ /// all of the following pairs of declarations are equivalent:
192
+ ///
193
+ /// ```swift
194
+ /// struct MyStructure { }
195
+ /// struct MyStructere: Copyable { }
196
+ ///
197
+ /// protocol MyProtocol { }
198
+ /// protocol MyProtocol: Copyable { }
199
+ ///
200
+ /// XXX example of assoc type or Self
201
+ ///
202
+ /// func genericFunction<T>(t: T) { }
203
+ /// func genericFunction<T>(t: T) where T: Copyable { }
204
+ /// ```
205
+ ///
206
+ /// To suppress an implicit conformance to `Copyable`
207
+ /// you write `~Copyable`.
208
+ /// For example,
209
+ /// only copyable types can conform to `MyProtocol` in the example above,
210
+ /// but both copyable and noncopyable types
211
+ /// can conform to the following protocol:
212
+ ///
213
+ /// ```swift
214
+ /// protocol NoRequirements: ~Copyable { }
215
+ /// ```
216
+ ///
217
+ /// Extensions on the `Copyable` protocol are not allowed.
218
+ ///
219
+ /// XXX xref to TSPL
172
220
@_marker public protocol Copyable { }
173
221
174
222
@_marker public protocol Escapable { }
0 commit comments