Skip to content

Conversation

rjmccall
Copy link
Contributor

6.2 version of #84181 and #84206.

Scope: SILGen changes to the emission of nonisolated(nonsending) functions; a few related fixes to defer bodies; also fixes an adjacent crash-on-request-cycle
Reviewed by: @ktoso
Risk: Fairly low. Most of the impact is to nonisolated(nonsending) functions, which are a new feature in Swift 6.2. That fix includes a fix to defer bodies which has revealed a series of related bugs in defer. I believe this PR fully plumbs the defer bugs, but it's possible that there some problems still lurking.
Testing: several new regression tests

The first bug is that we weren't computing isolation correctly for
nested defers. This is an unlikely pattern of code, but it's good to fix.

The second bug is that getActorIsolationOfContext was looking through
defers, but getActorIsolation itself was not. This was causing defer
bodies to be emitted in SILGen without an isolation parameter, which
meant that #isolation could not possibly provide the right value. Fixing
this involves teaching SILGen that non-async functions can have
nonisolated(nonsending) isolation, but that's relatively straightforward.

This commit doesn't fix #isolation or adequately test SILGen, but that'll
be handled in a follow-up.
closures.

The fixes for initializers are just setting the stage for doing this
properly: we should be able to just change the isolation computation
in Sema and fix up the tests.
@rjmccall rjmccall requested a review from a team as a code owner September 12, 2025 02:04
@rjmccall
Copy link
Contributor Author

@swift-ci Please test

@rjmccall
Copy link
Contributor Author

@swift-ci Please test

@rjmccall rjmccall merged commit 634c818 into swiftlang:release/6.2 Sep 13, 2025
5 checks passed
@rjmccall rjmccall deleted the isolation-fixed-6.2 branch September 13, 2025 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants