-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Implement -strict-concurrency control and default to "minimal" #42523
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
Merged
DougGregor
merged 11 commits into
swiftlang:release/5.7
from
DougGregor:strict-concurrency-minimal-5.7
Apr 21, 2022
Merged
Implement -strict-concurrency control and default to "minimal" #42523
DougGregor
merged 11 commits into
swiftlang:release/5.7
from
DougGregor:strict-concurrency-minimal-5.7
Apr 21, 2022
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
Replace `-warn-concurrency` with a more granular option `-swift-concurrency=`, where the developer can select one of three different "modes": * `off` disables `Sendable` checking for most cases. (This is the Swift 5.5 and Swift 5.6 behavior.) * `limited` enables `Sendable` checking within code that has adopted Swift concurrency. (This is currently the default behavior.) * `on` enables `Sendable` and other concurrency checking throughout the module. (This is equivalent to `-warn-concurrency` now). There is currently no distinction between `off` and `limited`. That will come soon. Implements the flag part of rdar://91930849. (cherry picked from commit 7a724c4)
`isConcurrencyChecked()` was being used as a proxy for `-warn-concurrency` that didn't account for Swift 6. Replace checks against it within the current module with checks against the strict concurrency level, which subsumes the Swift 6 check and can account for the difference between "limited" and "on". `isConcurrencyChecked()` is used now used exclusively to mean "treat a missing Sendable conformance as an explicitly-non-Sendable type". (cherry picked from commit d200644)
(cherry picked from commit a87ff78)
(cherry picked from commit 4306c9c)
(cherry picked from commit dd6a061)
This isolates us from changes in the default. (cherry picked from commit f404b58)
(cherry picked from commit 3f4bc7d)
The three options are now: * `explicit`: Enforce Sendable constraints where it has been explicitly adopted and perform actor-isolation checking wherever code has adopted concurrency. (This is the default) * `targeted`: Enforce Sendable constraints and perform actor-isolation checking wherever code has adopted concurrency, including code that has explicitly adopted Sendable. * `complete`: Enforce Sendable constraints and actor-isolation checking throughout the entire module. (cherry picked from commit 4116d7a)
This makes it far more clear what the relative ordering of the options is. Thanks, Jake!
Emulate the behavior of Swift 5.5/5.6 by default, using `-strict-concurrency=minimal`.
@swift-ci please test |
@swift-ci please test |
ktoso
approved these changes
Apr 21, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, though I wonder if some of the longer descriptions from the enum about minimal
could benefit being in the command line. Not really important tho as in reality folks can "try out and see which one does what they want" :)
airspeedswift
approved these changes
Apr 21, 2022
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.
Replace
-warn-concurrency
with a more granular option-swift-concurrency=
, where the developer can select one of threedifferent "modes":
minimal
disablesSendable
checking for most cases. (This is the Swift5.5 and Swift 5.6 behavior, and the default for now)
targeted
enablesSendable
checking within code that has adoptedSwift concurrency.
complete
enablesSendable
and other concurrency checking throughoutthe module. (This is equivalent to
-warn-concurrency
now).Implements rdar://91930849.