-
Notifications
You must be signed in to change notification settings - Fork 460
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
New concurrency warnings when building with Swift 5.10 #1560
Comments
fyi - @tbkka @FranzBusch @Lukasa |
I went ahead and opened #1561 for topic of revisiting |
|
Ok, so I think |
Why would The thing being flagged about |
Based on my (limited) understanding, we should mark the backing class as |
I don't think we should make the backing class |
What do you mean by backing class? And holding class? Right now we mark the message structs at [Edited] |
The
@FranzBusch So how do we deal with the static global that holds an empty copy of that class? Those are the errors that @thomasvl is referring to above. |
@FranzBusch suggested to me offline that
|
Opened #1563 for some of the issues. |
I think this is the rest of the issues in apple#1560 This is the different approach discussed in apple#1564.
With the repeated ones out of the way, here are some of the additional ones I'm seeing:
|
The |
I couldn't find an immediate issue, can't hurt to file a new one. |
I think this is the rest of the issues in apple#1560 This is the different approach discussed in apple#1564.
I think this is the rest of the issues in apple#1560 This is the different approach discussed in apple#1564.
I think this is the rest of the issues in apple#1560 This is the different approach discussed in apple#1564.
Actually, I might have pulled those off the branch build, where I think some things haven't built, let me try the |
Ok, here's a test on
Aside: things get printing multiple times which makes me wonder if 5.10 has some other issue going on. @FranzBusch @Lukasa @tbkka – given the problems with |
Oh no. If I build on my Mac with Xcode 15.3, I don't get either of these. Does that mean Linux's version of Any suggestions for that then? |
I guess we could hack the resource one with a |
AppleStore only requires the informatiion on iOS, watchOS, tvOS, visionOS; so exclude the resources for Linux and macOS. As of Swift 5.10 (apple#1560), the generated Linux code when there are resources gets flagged with issues when using `StrictConcurrency=complete`; so this dodges the issue.
AppleStore only requires the informatiion on iOS, watchOS, tvOS, visionOS; so exclude the resources for Linux and macOS. As of Swift 5.10 (apple#1560), the generated Linux code when there are resources gets flagged with issues when using `StrictConcurrency=complete`; so this dodges the issue.
For the dispatch queue issue, use |
Did you file an issue for the Module warning? |
Ha, I'm testing that out now, I'll move that to it's own PR shortly.
Haven't gotten there yet. If you'd got the time to do it, it will likely get more attention if filed by one of you. |
|
This warning is firing on Linux? |
Yup - https://github.com/apple/swift-protobuf/actions/runs/8345218414/job/22839591811?pr=1585 |
See apple#1560 for the details, but things currently don't pass on linux, and some of the issues are within the Swift toolchain.
See apple#1560 for the details, but things currently don't pass on linux, and some of the issues are within the Swift toolchain.
See apple#1560 for the details, but things currently don't pass on linux, and some of the issues are within the Swift toolchain.
See #1560 for the details, but things currently don't pass on linux, and some of the issues are within the Swift toolchain.
I don't appear to get the So I think we're down to all problems in the Swift Linux distro now. Everything we can control should be warning free. |
We should be able to fix the warning with |
Looking back at that code, we don't really need to use |
Now we're down to just the generated file for resources and then the dispatch related one. Guess it's safe to close this now since we've done everything we can for the 5.10 specific issues. |
I happened to be looking at swift-nio, and realized they did do the conditional in |
I'm going to go ahead and close this since it was specific to 5.10. We may end up revisit some things for Swift 6, but it feels like that should be a new issue. |
Related: #1729 |
As a consequence of SE-0412: Strict concurrency for global variables, we're getting new concurrency warnings when building swift-protobuf. They can be narrowed down to two places:
Default instances of storage classes:
The
_NameMap
of each generated message:SE-0412 added the requirements that:
Neither the storage classes nor
_NameMap
areSendable
. I need some more eyes who are better versed with Swift concurrency than I am 🙂Storage classes
For the storage classes, we could just drop the
defaultInstance
property entirely and just allocate a new empty instance. However, it is a nice optimization to defer allocation of storage until the message is actually mutated. It's not super important if you're creating a new message and then immediately parsing or mutating it, but anywhere that we return an empty message as a default value of an unset message-typed field, it's very nice to not have to allocate storage if the user is only going to read from it.Can we just mark the storage classes as
Sendable
on@unchecked Sendable
since the messages themselves already conform to that, and the storage types can't be accessed from outside the message?_NameMap
_NameMap
looked more challenging because of the string interning logic and storage ofUnsafe*Pointer
s, but upon further reflection, a_NameMap
can never be mutated after its been initialized, so I think we could just declare_NameMap
to be@unchecked Sendable
and call it a day, right?As a follow-up, now that Swift
String
s are UTF-8 backed, we could probably revisit the UTF-8 buffer interning approach and just storeString
s directly. The UTF-8 buffer interning dates back to 2017, so it was when Swift native strings weren't guaranteed to be UTF-8 backed, which I believe was the original motivation for the buffer approach.The text was updated successfully, but these errors were encountered: