-
Notifications
You must be signed in to change notification settings - Fork 50
Suppress compiler warnings about Errors with non-Sendable members #727
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
Conversation
ea47549
to
44e7c15
Compare
A type conforming to `Error` must be `Sendable`, but `DelimiterLexError` and `CompilerLexError` carry source locations represented by `UnsafeRawPointer`, which is inherently non-`Sendable`. The compiler diagnoses the failure to meet `Sendable` requirements on these error types, which will prevent Swift 6 adoption in `_RegexParser` and also generates build log spam every time the compiler and standard library are built. There are a couple ways to resolve this problem: 1. Refactor so that the errors to not need to carry source locations. 2. Refactor to avoid using `Error` (the code using these errors would not require `Sendable` if it were not for `Error`'s inherent `Sendable` requirement). 3. Suppress the warnings with a `@uncheck Sendable` wrapper. Option 1 probably requires significant refactoring and option 2 seems undesirable since it means that the implementation must forgo the convenience of Swift's error handling model. Therefore this PR implements option 3 as the most expedient way to stop the diagnostic spam, leaving improvement on the status quo as a future exercise.
44e7c15
to
69fa54d
Compare
@swift-ci please test |
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.
Thanks!
@swift-ci please test Windows |
Suppress compiler warnings about Errors with non-Sendable members
Unless there are exceptional circumstances, please make changes on Updating |
Sorry, I think I'm just very confused about how this is supposed to work in this repo. It looked to me like |
Suppress compiler warnings about Errors with non-Sendable members
A type conforming to
Error
must beSendable
, butDelimiterLexError
andCompilerLexError
carry source locations represented byUnsafeRawPointer
, which is inherently non-Sendable
. The compiler diagnoses the failure to meetSendable
requirements on these error types, which will prevent Swift 6 adoption in_RegexParser
and also generates build log spam every time the compiler and standard library are built. There are a couple ways to resolve this problem:Error
(the code using these errors would not requireSendable
if it were not forError
's inherentSendable
requirement).@unchecked Sendable
wrapper.Option 1 probably requires significant refactoring and option 2 seems undesirable since it means that the implementation must forgo the convenience of Swift's error handling model. Therefore this PR implements option 3 as the most expedient way to stop the diagnostic spam, leaving improvement on the status quo as a future exercise.
Also includes a drive-by fix for a trivial, unrelated warning.