-
Notifications
You must be signed in to change notification settings - Fork 232
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
[Swift 6] Compilation issues when migrating to Swift 6 #2279
Comments
Relevant: #2046 @trevoranderson I agree that it would be good with the By longer term plan is probably to put the |
I believe the way to reproduce this is to add It looks like I get the same errors on swift |
Found this issue after recently hitting it myself. While there's more I'm sure I'm not seeing, would a PR changing that hosted initialization from a |
PR's certainly welcome, and a trivial change like you mention would be a no-brainer IMO. Other changes might stretch the limits of our knowledge so might take more time to evaluate, but we certainly welcome them! |
I just opened #2290 to provide the "quick and easy" fix here - switching the |
Converted some more vars to lets. Swift still complains about async calls. I believe the next step would be to make all UniFFI objects conform to `Sendable`. See mozilla#2279.
Converted some more vars to lets. Swift still complains about async calls. I believe the next step would be to make all UniFFI objects conform to `Sendable`. See mozilla#2279.
Converted some more vars to lets. Swift still complains about async calls. I believe the next step would be to make all UniFFI objects conform to `Sendable`. Split the `FfiType::Reference` variant into `Reference` and `MutReference`. This allows us to define some more variables using `let` in swift. See mozilla#2279.
I converted some more variables to |
Similar to #2274 but adding a few more from my project. This is all tested by setting
SWIFT_STRICT_CONCURRENCY = complete
in the project's build settings in XCode. Most of the issues are on the class that Swift passes into Rust to get notified about certain events. I believe it's calledForeign traits
in the docs.Foreign Trait Swift 6 concurrency issues
gives the error
another location
gives the error
Initialization Result Swift 6 concurrency issues
This last one is perhaps more important because it seems like it will affect all Rust+Swift users. The comment seems to disagree with the compiler. (This one might be fixable by switching
var
tolet
)produces error
Fixing
In all cases, the trivial fix is to mark the relevant locations as
nonisolated(unsafe) var
, which should immediately solve the warnings and allow users to migrate to Swift6 while a more "Swifty" solution is designed. TheInitializationResult
one looks like just a one-liner bugThe text was updated successfully, but these errors were encountered: