Skip to content

Commit d812e11

Browse files
authored
Merge pull request #73992 from gottesmm/pr-11733548e1925dd1e75751e1b2f1650668a008ae
Add ChangeLog entries for SE-0414 and SE-0430
2 parents 475ca65 + 5bbdb28 commit d812e11

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

CHANGELOG.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,51 @@
117117
let old = self.id // <- partial consumption of 'self'
118118
self = .init(id: new, name: self.name)
119119
return old
120-
}
120+
}
121+
}
122+
```
123+
124+
* [SE-0430][]:
125+
126+
Region Based Isolation is now extended to enable the application of an
127+
explicit `sending` annotation to function parameters and results. A function
128+
parameter or result that is annotated with `sending` is required to be
129+
disconnected at the function boundary and thus possesses the capability of
130+
being safely sent across an isolation domain or merged into an actor-isolated
131+
region in the function's body or the function's caller respectively. Example:
132+
133+
```swift
134+
func parameterWithoutSending(_ x: NonSendableType) async {
135+
// Error! Cannot send a task-isolated value to the main actor!
136+
await transferToMainActor(x)
137+
}
138+
139+
func parameterWithSending(_ x: sending NonSendableType) async {
140+
// Ok since `x` is `sending` and thus disconnected.
141+
await transferToMainActor(x)
142+
}
143+
```
144+
145+
* [SE-0414][]:
146+
147+
The compiler is now capable of determining whether or not a value that does
148+
not conform to the `Sendable` protocol can safely be sent over an isolation
149+
boundary. This is done by introducing the concept of *isolation regions* that
150+
allows the compiler to reason conservatively if two values can affect each
151+
other. Through the usage of isolation regions, the compiler can now prove that
152+
sending a value that does not conform to the `Sendable` protocol over an
153+
isolation boundary cannot result in races because the value (and any other
154+
value that might reference it) is not used in the caller after the point of
155+
sending allowing code like the following to compile:
156+
157+
```swift
158+
actor MyActor {
159+
init(_ x: NonSendableType) { ... }
160+
}
161+
162+
func useValue() {
163+
let x = NonSendableType()
164+
let a = await MyActor(x) // Error without Region Based Isolation!
121165
}
122166
```
123167

@@ -10405,6 +10449,8 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
1040510449
[SE-0427]: https://github.com/apple/swift-evolution/blob/main/proposals/0427-noncopyable-generics.md
1040610450
[SE-0429]: https://github.com/apple/swift-evolution/blob/main/proposals/0429-partial-consumption.md
1040710451
[SE-0432]: https://github.com/apple/swift-evolution/blob/main/proposals/0432-noncopyable-switch.md
10452+
[SE-0414]: https://github.com/apple/swift-evolution/blob/main/proposals/0414-region-based-isolation.md
10453+
[SE-0430]: https://github.com/apple/swift-evolution/blob/main/proposals/0430-transferring-parameters-and-results.md
1040810454
[SE-0418]: https://github.com/apple/swift-evolution/blob/main/proposals/0418-inferring-sendable-for-methods.md
1040910455
[SE-0423]: https://github.com/apple/swift-evolution/blob/main/proposals/0423-dynamic-actor-isolation.md
1041010456
[#64927]: <https://github.com/apple/swift/issues/64927>

0 commit comments

Comments
 (0)