Skip to content

Commit efe5f96

Browse files
authored
Merge branch 'swiftlang:main' into master
2 parents 02e9dfd + 07e7020 commit efe5f96

28 files changed

+1878
-399
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ This repository tracks the ongoing evolution of the Swift programming language,
1111

1212
| Version | Announced | Released |
1313
| :-------- | :----------------------------------------------------------------------- | :----------------------------------------------------------- |
14-
| Swift 6.1 | [2024-10-17](https://forums.swift.org/t/swift-6-1-release-process/75442) |
14+
| Swift 6.2 | [2025-03-08](https://forums.swift.org/t/swift-6-2-release-process/78371) | |
15+
| Swift 6.1 | [2024-10-17](https://forums.swift.org/t/swift-6-1-release-process/75442) | [2025-03-31](https://www.swift.org/blog/swift-6.1-released/) |
1516
| Swift 6.0 | [2024-02-22](https://forums.swift.org/t/swift-6-0-release-process/70220) | [2024-09-17](https://www.swift.org/blog/announcing-swift-6/) |
1617
| Swift 5.10 | [2023-08-23](https://forums.swift.org/t/swift-5-10-release-process/66911) | [2024-03-05](https://www.swift.org/blog/swift-5.10-released/) |
1718
| Swift 5.9 | [2023-03-06](https://forums.swift.org/t/swift-5-9-release-process/63557) | [2023-09-18](https://www.swift.org/blog/swift-5.9-released/) |

proposals/0428-resolve-distributed-actor-protocols.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ The macro must be attached to the a `protocol` declaration that is a `Distribute
9090
import Distributed
9191

9292
@Resolvable
93-
protocol Greeter where ActorSystem: DistributedActorSystem<any Codable> {
93+
protocol Greeter: DistributedActor where ActorSystem: DistributedActorSystem<any Codable> {
9494
distributed func greet(name: String) -> String
9595
}
9696
```

proposals/0439-trailing-comma-lists.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ let subsequences = numbers.split(
4343

4444
### The Language Evolved
4545

46-
Back in 2016, a similar [proposal](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0084-trailing-commas.md) with a narrower scope was reviewed and rejected for Swift 3. Since that time, the language has evolved substantially that challenges the basis for rejection. The code style that "puts the terminating right parenthesis on a line following the arguments to that call" has been widely adopted by community, Swift standard library codebase, swift-format, docc documentation and Xcode. Therefore, not encouraging or endorsing this code style doesn't hold true anymore.
46+
Back in 2016, a similar [proposal](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0084-trailing-commas.md) with a narrower scope was reviewed and rejected for Swift 3. Since that time, the language has evolved substantially that challenges the basis for rejection. The code style that "puts the terminating right parenthesis on a line following the arguments to that call" has been widely adopted by community, Swift standard library codebase, swift-format, DocC documentation and Xcode. Therefore, not encouraging or endorsing this code style doesn't hold true anymore.
4747

4848
The language has also seen the introduction of [parameter packs](https://github.com/apple/swift-evolution/blob/main/proposals/0393-parameter-packs.md), which enables APIs that are generic over variable numbers of type parameters, and code generation tools like plugins and macros that, with trailing comma support, wouldn't have to worry about a special condition for the last element when generating comma-separated lists.
4949

@@ -267,16 +267,7 @@ if
267267

268268
This particular case can be handled but, given how complex conditions can be, it's hard to conclude that there's absolutely no corner case where ambiguity can arise in currently valid code.
269269

270-
Inheritance lists and generic `where` clauses can appear in protocol definitons where there's no clear delimiter, making it harder to disambiguate where the list ends.
271-
272-
```swift
273-
protocol Foo {
274-
associatedtype T:
275-
P1,
276-
P2, ❌ Expected type
277-
...
278-
}
279-
```
270+
Inheritance lists and generic `where` clauses can appear in protocol definitions where there's no clear delimiter, making it harder to disambiguate where the list ends.
280271

281272
```swift
282273
protocol Foo {

proposals/0456-stdlib-span-properties.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Proposal: [SE-0456](0456-stdlib-span-properties.md)
44
* Author: [Guillaume Lessard](https://github.com/glessard)
55
* Review Manager: [Doug Gregor](https://github.com/DougGregor)
6-
* Status: **Accepted**
6+
* Status: **Implemented (Swift 6.2)**
77
* Roadmap: [BufferView Roadmap](https://forums.swift.org/t/66211)
8-
* Implementation: [PR #78561](https://github.com/swiftlang/swift/pull/78561)
8+
* Implementation: [swift PR #78561](https://github.com/swiftlang/swift/pull/78561), [swift PR #80116](https://github.com/swiftlang/swift/pull/80116), [swift-foundation PR#1276](https://github.com/swiftlang/swift-foundation/pull/1276)
99
* Review: ([pitch](https://forums.swift.org/t/76138)) ([review](https://forums.swift.org/t/se-0456-add-span-providing-properties-to-standard-library-types/77233)) ([acceptance](https://forums.swift.org/t/77684))
1010

1111
[SE-0446]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0446-non-escapable.md

proposals/0464-utf8span-safe-utf8-processing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Proposal: [SE-0464](0464-utf8span-safe-utf8-processing.md)
44
* Authors: [Michael Ilseman](https://github.com/milseman), [Guillaume Lessard](https://github.com/glessard)
55
* Review Manager: [Tony Allevato](https://github.com/allevato)
6-
* Status: **Accepted**
6+
* Status: **Implemented (6.2)**
77
* Bug: rdar://48132971, rdar://96837923
88
* Implementation: [swiftlang/swift#78531](https://github.com/swiftlang/swift/pull/78531)
99
* Review: ([first pitch](https://forums.swift.org/t/pitch-utf-8-processing-over-unsafe-contiguous-bytes/69715)) ([second pitch](https://forums.swift.org/t/pitch-safe-utf-8-processing-over-contiguous-bytes/72742)) ([third pitch](https://forums.swift.org/t/pitch-utf8span-safe-utf-8-processing-over-contiguous-bytes/77483)) ([review](https://forums.swift.org/t/se-0464-utf8span-safe-utf-8-processing-over-contiguous-bytes/78307)) ([acceptance](https://forums.swift.org/t/accepted-with-modifications-se-0464-safe-utf-8-processing-over-contiguous-bytes/79218))

proposals/0465-nonescapable-stdlib-primitives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Proposal: [SE-0465](0465-nonescapable-stdlib-primitives.md)
44
* Authors: [Karoy Lorentey](https://github.com/lorentey)
55
* Review Manager: [Doug Gregor](https://github.com/douggregor)
6-
* Status: **Accepted**
6+
* Status: **Implemented (Swift 6.2)**
77
* Roadmap: [Improving Swift performance predictability: ARC improvements and ownership control][Roadmap]
88
* Implementation: https://github.com/swiftlang/swift/pull/73258
99
* Review: ([Acceptance](https://forums.swift.org/t/accepted-se-0465-standard-library-primitives-for-nonescapable-type/78637)) ([Review](https://forums.swift.org/t/se-0465-standard-library-primitives-for-nonescapable-types/78310)) ([Pitch](https://forums.swift.org/t/pitch-nonescapable-standard-library-primitives/77253))

proposals/0466-control-default-actor-isolation.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Control default actor isolation inference
22

33
* Proposal: [SE-0466](0466-control-default-actor-isolation.md)
4-
* Authors: [Holly Borla](https://github.com/hborla)
4+
* Authors: [Holly Borla](https://github.com/hborla), [Doug Gregor](https://github.com/DougGregor)
55
* Review Manager: [Steve Canon](https://github.com/stephentyrone)
6-
* Status: **Implemented (Swift 6.2)**
6+
* Status: **Active review (July 8...15, 2025)**
77
* Vision: [Improving the approachability of data-race safety](/visions/approachable-concurrency.md)
8-
* Review: ([pitch](https://forums.swift.org/t/pitch-control-default-actor-isolation-inference/77482))([review](https://forums.swift.org/t/se-0466-control-default-actor-isolation-inference/78321))([acceptance](https://forums.swift.org/t/accepted-se-0466-control-default-actor-isolation-inference/78926))
8+
* Review: ([pitch](https://forums.swift.org/t/pitch-control-default-actor-isolation-inference/77482))([review](https://forums.swift.org/t/se-0466-control-default-actor-isolation-inference/78321))([acceptance](https://forums.swift.org/t/accepted-se-0466-control-default-actor-isolation-inference/78926))([amendment pitch](https://forums.swift.org/t/pitch-amend-se-0466-se-0470-to-improve-isolation-inference/79854))([amendment review](https://forums.swift.org/t/amendment-se-0466-control-default-actor-isolation-inference/80994))
99

1010
## Introduction
1111

@@ -65,6 +65,7 @@ When the default actor isolation is specified as `MainActor`, declarations are i
6565
* Declarations with inferred actor isolation from a superclass, overridden method, protocol conformance, or member propagation
6666
* All declarations inside an `actor` type, including static variables, methods, initializers, and deinitializers
6767
* Declarations that cannot have global actor isolation, including typealiases, import statements, enum cases, and individual accessors
68+
* Declarations whose primary definition directly conforms to a protocol that inherits `SendableMetatype`
6869

6970
The following code example shows the inferred actor isolation in comments given the code is built with `-default-isolation MainActor`:
7071

@@ -107,6 +108,16 @@ struct S: P {
107108
// @MyActor
108109
func f() { ... }
109110
}
111+
112+
nonisolated protocol Q: Sendable { }
113+
114+
// nonisolated
115+
struct S2: Q { }
116+
117+
// @MainActor
118+
struct S3 { }
119+
120+
extension S3: Q { }
110121
```
111122

112123
This proposal does not change the default isolation inference rules for closures. Non-Sendable closures and closures passed to `Task.init` already have the same isolation as the enclosing context by default. When specifying `MainActor` isolation by default in a module, non-`@Sendable` closures and `Task.init` closures will have inferred `@MainActor` isolation when the default `@MainActor` inference rules apply to the enclosing context:
@@ -166,23 +177,37 @@ Similarly, a future language mode could enable main actor isolation by default,
166177

167178
See the approachable data-race safety vision document for an [analysis on the risks of introducing a language dialect](https://github.com/hborla/swift-evolution/blob/approachable-concurrency-vision/visions/approachable-concurrency.md#risks-of-a-language-dialect) for default actor isolation.
168179

169-
### Don't apply default actor isolation to explicitly `Sendable` types
180+
### Alternative to `SendableMetatype` for suppressing main-actor inference
181+
182+
The protocols to which a type conforms can affect the isolation of the type. Conforming to a global-actor-isolated protocol can infer global-actor isolatation for the type. When the default actor isolation is `MainActor`, it is valuable for protocols to be able to push inference toward keeping conforming types `nonisolated`, for example because conforming types are meant to be usable from any isolation domain.
170183

171-
This proposal includes few exceptions where the specified default actor isolation does not apply. An additional case that should be considered is types with a conformance to `Sendable`:
184+
In this proposal, inheritance from `SendableMetatype` (introduced in [SE-0470](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0470-isolated-conformances.md)) is used as an indication that types conforming to the protocol should be `nonisolated`. The `SendableMetatype` marker protocol indicates when a type (but not necessarily its instances) can cross isolation domains, which implies that the type generally needs to be usable from any isolation domain. Additionally, protocols that inherit from `SendableMetatype` can only be meaningfully be used with nonisolated conformances, as discussed in SE-0470. Experience using default main actor isolation uncovered a number of existing protocols that reinforce the notion of `SendableMetatype` inheritance is a reasonable heuristic to indicate that a conforming type should be nonisolated: the standard library's [`CodingKey`](https://developer.apple.com/documentation/swift/codingkey) protocol inherits `Sendable` (which in turn inherits `SendableMetatype`) so a typical conformance will fail to compile with default main actor isolation:
172185

173186
```swift
174-
struct SimpleValue: Sendable {
175-
var value: Int
187+
struct S: Codable {
188+
var a: Int
189+
190+
// error if CodingKeys is inferred to `@MainActor`. The conformance cannot be main-actor-isolated, and
191+
// the requirements of the (nonisolated) CodingKey cannot be satisfied by main-actor-isolated members of
192+
// CodingKeys.
193+
enum CodingKeys: CodingKey {
194+
case a
195+
}
176196
}
177197
```
178198

179-
This is an attractive carve out upon first glance, but there are a number of downsides:
199+
Other places that have similar issues with default main actor isolation include the [`Transferable`](https://developer.apple.com/documentation/coretransferable/transferable) protocol and the uses of key paths in the [`@Model` macro](https://developer.apple.com/documentation/swiftdata/model()).
180200

181-
* The carve out may be confusing if a conformance to `Sendable` is implied, e.g. through a conformance to another protocol.
182-
* Global actor isolation implies a conformance to `Sendable`, so it's not clear that a `Sendable` type should not be global actor isolated.
183-
* Methods on a `Sendable` type may still use other types and methods that have default actor isolation applied, which would lead to failures if the `Sendable` type was exempt from default isolation inference.
201+
Instead of using `SendableMetatype` inheritance, this proposal could introduce new syntax for a protocol to explicitly indicate
184202

185-
A middle ground might be to not apply default actor isolation to types with an explicit conformance to `Sendable` within the same source file as the type. This approach would still have some of the downsides listed above, but it would be more straightforward to spot types that have this exemption.
203+
```swift
204+
@nonisolatedConformingTypes
205+
public protocol CodingKey {
206+
// ...
207+
}
208+
```
209+
210+
This would make the behavior pushing conforming types toward `nonisolated` opt-in. However, it means that existing protocols (such as the ones mentioned above) would all need to adopt this spelling before code using default main actor isolation will work well. Given the strong semantic link between `SendableMetatype` and `nonisolated` conformances and types, the proposed rule based on `SendableMetatype` inheritance is likely to make more code work well with default main actor isolation. An explicit opt-in attribute like the above could be added at a later time if needed.
186211

187212
### Use an enum for the package manifest API
188213

@@ -213,6 +238,11 @@ The enum approach introduces a different way of writing main actor isolation tha
213238

214239
The primary argument for using an enum is that it can be extended in the future to support custom global actor types. This proposal deliberately puts supporting custom global actors in the alternatives considered and not future directions, because defaulting a module to a different global actor does not help improve progressive disclosure for concurrency.
215240

241+
## Revision history
242+
243+
* Changes in amendment review:
244+
* Disable `@MainActor` inference when type conforms to a `SendableMetatype` protocol
245+
216246
## Acknowledgments
217247

218248
Thank you to John McCall for providing much of the motivation for this pitch in the approachable data-race safety vision document, and to Michael Gottesman for helping with the implementation.

proposals/0467-MutableSpan.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Proposal: [SE-0467](0467-MutableSpan.md)
44
* Author: [Guillaume Lessard](https://github.com/glessard)
55
* Review Manager: [Joe Groff](https://github.com/jckarter)
6-
* Status: **Accepted**
6+
* Status: **Implemented (Swift 6.2)**
77
* Roadmap: [BufferView Roadmap](https://forums.swift.org/t/66211)
8-
* Implementation: "Future" target of [swift-collections](https://github.com/apple/swift-collections/tree/future)
8+
* Implementation: [PR #79650](https://github.com/swiftlang/swift/pull/79650), [PR #80517](https://github.com/swiftlang/swift/pull/80517)
99
* Review: ([Pitch](https://forums.swift.org/t/pitch-mutablespan/77790)) ([Review](https://forums.swift.org/t/se-0467-mutablespan/78454)) ([Acceptance](https://forums.swift.org/t/accepted-se-0467-mutablespan/78875))
1010

1111
[SE-0446]: https://github.com/swiftlang/swift-evolution/blob/main/proposals/0446-non-escapable.md

proposals/0468-async-stream-continuation-hashable-conformance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Proposal: [SE-0468](0468-async-stream-continuation-hashable-conformance.md)
44
* Authors: [Mykola Pokhylets](https://github.com/nickolas-pohilets)
55
* Review Manager: [Freddy Kellison-Linn](https://github.com/Jumhyn)
6-
* Status: **Accepted**
6+
* Status: **Implemented (Swift 6.2)**
77
* Implementation: [swiftlang/swift#79457](https://github.com/swiftlang/swift/pull/79457)
88
* Review: ([pitch](https://forums.swift.org/t/pitch-add-hashable-conformance-to-asyncstream-continuation/77897)) ([review](https://forums.swift.org/t/se-0468-hashable-conformance-for-async-throwing-stream-continuation/78487)) ([acceptance](https://forums.swift.org/t/accepted-se-0468-hashable-conformance-for-async-throwing-stream-continuation/79116))
99

0 commit comments

Comments
 (0)