@@ -1988,12 +1988,13 @@ types also implicitly conform to these common protocol.
19881988For more information,
19891989see < doc:Protocols#Implicit-Conformance-to-a-Protocol > .
19901990
1991- To suppress an implicit constraint
1992- that requires conformance to a given protocol,
1991+ To suppress an implicit constraint,
19931992you write the protocol name with a tilde (` ~ ` ) in front of it.
1994- You can read the ` ~Copyable ` constraint as "maybe copyable",
1995- because values of this type
1996- can contain values of both copyable and noncopyable types.
1993+ You can read ` ~Copyable ` as "maybe copyable" ---
1994+ this suppressed constraint allows
1995+ both copyable and noncopyable types in this position.
1996+ Note that ` ~Copyable ` doesn't * require* the type to be noncopyable.
1997+ For example:
19971998
19981999``` swift
19992000func f <MyType >(x : inout MyType) {
@@ -2011,10 +2012,12 @@ In the code above,
20112012the function ` f() ` implicitly requires ` MyType ` to be copyable.
20122013Within the function body,
20132014the value of ` x ` is copied to ` x1 ` and ` x2 ` in the assignment.
2014- In contrast, ` g() ` suppresses the implicit constraint,
2015- which allows you to pass either a copyable or noncopyable type .
2015+ In contrast, ` g() ` suppresses the implicit constraint on ` AnotherType ` ,
2016+ which allows you to pass either a copyable or noncopyable value .
20162017Within the function body,
2017- the value of ` y ` is consumed instead of copied,
2018+ you can't copy the value of ` y `
2019+ because ` AnotherType ` might be noncopyable.
2020+ Assignment consumes the value of ` y `
20182021and it's an error to consume that value more than once.
20192022Noncopyable values like ` y `
20202023must be passed as in-out, borrowing, or consuming parameters ---
0 commit comments