Skip to content

Avoid issuing warning when user lib implements only ExecutorJob enqueue #68617

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

ktoso
Copy link
Contributor

@ktoso ktoso commented Sep 19, 2023

The latter example NIODefaultSerialEventLoopExecutor when the type is more available than the enqueue implementation provided via an extension would issue a warning that that this enqueue(ExecutorJob) would not be used which is not true.

We need to filter out all "default impls" from the stdlib as we issue this warning.

We also put a note on the offending declaration that one can remove now, to ease getting rid of warnings when possible

I believe this manifests only on macOS where the availability comes into play -- @FranzBusch can confirm from NIO CI.

Resolves rdar://115166475

The latter example NIODefaultSerialEventLoopExecutor when the type is
more available than the enqueue implementation provided via an
extrension would issue a warning that that this enqueue(ExecutorJob)
would not be used which is not true.

We need to filter out all "default impls" from the stdlib as we issue
this warning.

We also put a note on the offending declaration that one can remove now,
to ease getting rid of warnings when possible

Resolves rdar://115166475
@ktoso
Copy link
Contributor Author

ktoso commented Sep 19, 2023

@swift-ci please smoke test

@ktoso ktoso added the concurrency Feature: umbrella label for concurrency language features label Sep 19, 2023
@available(macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0, *)
extension NIODefaultSerialEventLoopExecutor: SerialExecutor {
@inlinable
public func enqueue(_ job: consuming ExecutorJob) { // do NOT issue a warning here
Copy link
Contributor Author

@ktoso ktoso Sep 19, 2023

Choose a reason for hiding this comment

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

in the meantime tbh you can implement the UnownedJob version to avoid warnings; they're effectively the same nowadays. @FranzBusch

Copy link
Member

Choose a reason for hiding this comment

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

Don't we get deprecation warnings when adding the UnownedJob implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, the deprecation only is when you'd call the method though right? The test confirms there are no warnings issued here 🤔 The UnownedJob itself is not deprecated.

And you could technically mark your enqueue impl as deprecated as well actually

@ktoso
Copy link
Contributor Author

ktoso commented Sep 19, 2023

@swift-ci please build toolchain macOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concurrency Feature: umbrella label for concurrency language features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants