You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add isolation argument to functions taking non-sendable async closures. (#624)
This PR adds an `isolation` parameter to several API functions that take
`async` closures that are not required to be sendable. As well, it adds
`sending` to those closures' return types where appropriate.
This change is necessary in Swift 6 because a non-sendable async closure
could be called in the wrong isolation domain otherwise. In particular,
if the caller is `@MainActor`-isolated, the closure will not be called
on the main actor and will therefore always hop, and a concurrency error
occurs:
```swift
@mainactor func f() async {
await confirmation {
// this inner closure is not actor-isolated, but can't be sent across
// isolation domains.
}
}
```
`withKnownIssue()` and `confirmation()` are affected, as are several
async overloads of the internal-but-public `__check()` function family.
This change is necessary for correctness, but is potentially
source-breaking if calling code directly references the modified
functions by full name.
Resolves#622.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
0 commit comments