Skip to content

[6.0🍒] Docs: add release note for SE-427 #73950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,40 @@

## Swift 6.0

* [SE-0427][]:
You can now suppress `Copyable` on protocols, generic parameters,
and existentials:

```swift
// Protocol does not require conformers to be Copyable.
protocol Flower: ~Copyable {
func bloom()
}

// Noncopyable type
struct Marigold: Flower, ~Copyable {
func bloom() { print("Marigold blooming!") }
}

// Copyable type
struct Hibiscus: Flower {
func bloom() { print("Hibiscus blooming!") }
}

func startSeason(_ flower: borrowing some Flower & ~Copyable) {
flower.bloom()
}

startSeason(Marigold())
startSeason(Hibiscus())
```

By writing `~Copyable` on a generic type, you're suppressing a default
`Copyable` constraint that would otherwise appear on that type. This permits
noncopyable types, which have no `Copyable` conformance, to conform to such
protocols and be substituted for those generic types. Full functionality of this
feature requires the newer Swift 6 runtime.

* Since its introduction in Swift 5.1 the @TaskLocal property wrapper was used to
create and access task-local value bindings. Property wrappers introduce mutable storage,
which was now properly flagged as potential source of concurrency unsafety.
Expand Down Expand Up @@ -10252,6 +10286,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
[SE-0412]: https://github.com/apple/swift-evolution/blob/main/proposals/0412-strict-concurrency-for-global-variables.md
[SE-0413]: https://github.com/apple/swift-evolution/blob/main/proposals/0413-typed-throws.md
[SE-0422]: https://github.com/apple/swift-evolution/blob/main/proposals/0422-caller-side-default-argument-macro-expression.md
[SE-0427]: https://github.com/apple/swift-evolution/blob/main/proposals/0427-noncopyable-generics.md
[#64927]: <https://github.com/apple/swift/issues/64927>
[#42697]: <https://github.com/apple/swift/issues/42697>
[#42728]: <https://github.com/apple/swift/issues/42728>
Expand Down