Skip to content
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

Adopt Swift 6 and audit for Sendable #5000

Merged
merged 15 commits into from
Jul 25, 2024

Conversation

parkera
Copy link
Contributor

@parkera parkera commented Jul 5, 2024

This patch:

  • Adopts Swift 6 mode for the libraries, executables, and tests
  • Updates all types for Sendable annotation, and adds a flag to require all future types to do so as well
  • Syncs with Darwin Foundation for noasync functions
  • Addresses all Sendable warnings.
    • In many cases this is done by using nonisolated(unsafe). This should be considered a short term workaround and not a design pattern. In the future, adding these will be disfavored and rightfully proving to the compiler that it is safe will be preferred. However, it's not practical to do all of that in one shot.
    • Many warnings were also addressed by use of new Synchronization types and more annotations.
  • Addresses all remaining warnings of all other types.

@parkera parkera requested review from jmschonfeld and iCharlesHu July 5, 2024 18:52
@parkera
Copy link
Contributor Author

parkera commented Jul 5, 2024

I'm not sure how reviewable this is. It is the result of repeated iteration and small fixes.

Copy link
Contributor

@jmschonfeld jmschonfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just did a quick skim since as you mentioned it's a large patch that's not easily reviewable, but I did catch one thing that might be worth double checking

@parkera parkera force-pushed the parkera/sendable_annotations branch 3 times, most recently from 0240cd7 to c5f3634 Compare July 16, 2024 14:59
@parkera parkera changed the base branch from package to main July 16, 2024 15:00
@parkera
Copy link
Contributor Author

parkera commented Jul 16, 2024

@swift-ci please test

@parkera
Copy link
Contributor Author

parkera commented Jul 16, 2024

@swift-ci test

@Azoy
Copy link
Contributor

Azoy commented Jul 18, 2024

swiftlang/swift-foundation#742
@swift-ci please test

@jmschonfeld
Copy link
Contributor

@Azoy the linked PR only fixed the Synchronization import for FoundationEssentials/FoundationInternationalization. We'll need to make the same changes to Foundation/FoundationNetworking/FoundationXML here before importing Synchronization from these modules will work

@parkera parkera force-pushed the parkera/sendable_annotations branch from e04a8f8 to 203ed95 Compare July 19, 2024 03:35
@parkera
Copy link
Contributor Author

parkera commented Jul 19, 2024

@swift-ci test

1 similar comment
@parkera
Copy link
Contributor Author

parkera commented Jul 19, 2024

@swift-ci test

@parkera parkera force-pushed the parkera/sendable_annotations branch from 203ed95 to 5cb2337 Compare July 22, 2024 23:24
@parkera
Copy link
Contributor Author

parkera commented Jul 22, 2024

@swift-ci test

@parkera parkera force-pushed the parkera/sendable_annotations branch from d3e3766 to c2bc79a Compare July 23, 2024 21:18
@parkera
Copy link
Contributor Author

parkera commented Jul 23, 2024

@swift-ci test

@parkera
Copy link
Contributor Author

parkera commented Jul 24, 2024

@swift-ci test

@parkera
Copy link
Contributor Author

parkera commented Jul 25, 2024

@swift-ci test windows

@parkera parkera merged commit af24464 into swiftlang:main Jul 25, 2024
2 of 3 checks passed
parkera added a commit to parkera/swift-corelibs-foundation that referenced this pull request Jul 25, 2024
* Adopt Sendable, fix Sendable related warnings, and fix other warnings in both Swift and C code

* Upgrade to Swift 6 - Fix associated warnings

* Remove Sendable annotation from NSAffineTransform

* Cleanup some unused types in Utilities and use a Mutex instead of NSLock

* Remove some warnings for Windows builds

* Add version 6 and warning flags to CMake file

* Adapt to some changes in how unchecked Sendable conformance is declared

* Update swift-foundation dependency

* Update locking strategy for DateFormatter and NumberFormatter - keep the CF type inside the lock

* Add annotations for Core and CFSocketRef

* Resolve a warning in TestDecimal

* Use noncopyable State type for DateFormatter and NumberFormatter

* Mark DirectoryEnumerator as non-Sendable

* Work around compiler crashes when using ~Copyable types

* Clarify comment of _nonSendable with a message explaining the remaining warning
parkera added a commit that referenced this pull request Jul 25, 2024
* Adopt Sendable, fix Sendable related warnings, and fix other warnings in both Swift and C code

* Upgrade to Swift 6 - Fix associated warnings

* Remove Sendable annotation from NSAffineTransform

* Cleanup some unused types in Utilities and use a Mutex instead of NSLock

* Remove some warnings for Windows builds

* Add version 6 and warning flags to CMake file

* Adapt to some changes in how unchecked Sendable conformance is declared

* Update swift-foundation dependency

* Update locking strategy for DateFormatter and NumberFormatter - keep the CF type inside the lock

* Add annotations for Core and CFSocketRef

* Resolve a warning in TestDecimal

* Use noncopyable State type for DateFormatter and NumberFormatter

* Mark DirectoryEnumerator as non-Sendable

* Work around compiler crashes when using ~Copyable types

* Clarify comment of _nonSendable with a message explaining the remaining warning
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