-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add experimental feature to defer Sendable checking to SILGen #66874
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
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…s, and possibly defer their production. Does not build yet due to failing static asserts.
…s to enable AST allocation and trivial deallocation.
… and controlflow in ActorIsolationChecker::walkToExprPre
…dableDiagnostic instances - causing insertion of spurious SendNonSendableExpr's
…r, and produce its diagnostics during SILGen
…'s at their insertion site
…xperimental-feature DeferredSendableChecking
@swift-ci please smoke test |
superseded by #66929 |
1 similar comment
superseded by #66929 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently Sendable diagnostics such as
non-sendable type 'NonSendable' passed in call to actor-isolated instance method 'actorTakesNS' cannot cross actor boundary
are all produced during type checking. We want to add a SIL pass that uses flow-sensitive ownership analysis to determine that some of these diagnostic sites are actually safe (i.e. cannot yield data races), so the production of such diagnostics must be deferred to a SIL pass.This PR is an incremental step towards accomplishing that goal. Instead of being directly produced during type checking, a large class of sendable diagnostics (see the added test files in
swift/test/Concurrency/DeferredSendableChecking
for a characterization) are wrapped into closures that can be called later to produce the diagnostics. Those closures are wrapped inDeferredSendableDiagnostic
s - a class containing utilities for handling creation and accumulation that respects existing control flows - which are then placed inSendNonSendableExpr
AST nodes that are inserted at appropriate sites in the AST.SILGen responds to encountering these
SendNonSendableExpr
nodes by recursing to their subexpression, but calling their contained closure to emit the appropriate diagnostics before doing so.swift/test/Concurrency/DeferredSendableChecking
contains two identical test files, except that one is run with-typecheck
and the other is run withemit-silgen
. The former produces no diagnostics, the latter produces all diagnostics.This behavior is guarded behind the
-enable-experimental-feature DeferredSendableChecking
flag.