Skip to content

Make toplevel vars MainActor with -warn-concurrency #41763

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

Conversation

etcwilde
Copy link
Member

This is the last part to implement SE-0343. When -warn-concurrency is
passed to the compiler invocation, we want to protect top-level
variables behind the MainActor regardless of whether the top-level is an
asynchronous context. Note that this does not make the top-level an
asynchronous context, but it does put the top-level on the main actor,
so using main-actor-isolated variables is a synchronous operation from the top level.

This is the last part to implement SE-0343. When `-warn-concurrency` is
passed to the compiler invocation, we want to protect top-level
variables behind the MainActor regardless of whether the top-level is an
asynchronous context. Note that this does not make the top-level an
asynchronous context, but it does annotate the top-level as being a
main-actor-protected context.
@etcwilde etcwilde requested review from compnerd and DougGregor March 10, 2022 08:15
@etcwilde
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit c979b9f into swiftlang:main Mar 11, 2022
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.

3 participants