Skip to content

Commit 051e437

Browse files
committed
Docs: add release note for SE-427
(cherry picked from commit d70ce1a)
1 parent e37ba18 commit 051e437

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@
55
66
## Swift 6.0
77

8+
* [SE-0427][]:
9+
You can now suppress `Copyable` on protocols, generic parameters,
10+
and existentials:
11+
12+
```swift
13+
// Protocol does not require conformers to be Copyable.
14+
protocol Flower: ~Copyable {
15+
func bloom()
16+
}
17+
18+
// Noncopyable type
19+
struct Marigold: Flower, ~Copyable {
20+
func bloom() { print("Marigold blooming!") }
21+
}
22+
23+
// Copyable type
24+
struct Hibiscus: Flower {
25+
func bloom() { print("Hibiscus blooming!") }
26+
}
27+
28+
func startSeason(_ flower: borrowing some Flower & ~Copyable) {
29+
flower.bloom()
30+
}
31+
32+
startSeason(Marigold())
33+
startSeason(Hibiscus())
34+
```
35+
36+
By writing `~Copyable` on a generic type, you're suppressing a default
37+
`Copyable` constraint that would otherwise appear on that type. This permits
38+
noncopyable types, which have no `Copyable` conformance, to conform to such
39+
protocols and be substituted for those generic types. Full functionality of this
40+
feature requires the newer Swift 6 runtime.
41+
842
* Since its introduction in Swift 5.1 the @TaskLocal property wrapper was used to
943
create and access task-local value bindings. Property wrappers introduce mutable storage,
1044
which was now properly flagged as potential source of concurrency unsafety.
@@ -10252,6 +10286,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1025210286
[SE-0412]: https://github.com/apple/swift-evolution/blob/main/proposals/0412-strict-concurrency-for-global-variables.md
1025310287
[SE-0413]: https://github.com/apple/swift-evolution/blob/main/proposals/0413-typed-throws.md
1025410288
[SE-0422]: https://github.com/apple/swift-evolution/blob/main/proposals/0422-caller-side-default-argument-macro-expression.md
10289+
[SE-0427]: https://github.com/apple/swift-evolution/blob/main/proposals/0427-noncopyable-generics.md
1025510290
[#64927]: <https://github.com/apple/swift/issues/64927>
1025610291
[#42697]: <https://github.com/apple/swift/issues/42697>
1025710292
[#42728]: <https://github.com/apple/swift/issues/42728>

0 commit comments

Comments
 (0)