-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Cargo.toml: Deprecate executor specific features for sub-crates #2962
Conversation
We only want to emit the deprecation warning in case a user uses the old features and _not_ the new ones. This assumes that a user upgrades properly, i.e. adds the new `tokio` or `async-std` feature AND removes the old `tcp-tokio` feature from the list. We need to use this rather complex cfg expression because otherwise, our CI won't pass. We run clippy with `--all-features`, thus just detecting for presence of the `tcp-async-io` feature for example will always flag our examples as using deprecated code.
Otherwise CI will not pass once #2963 actually checks it properly.
In favor of this! |
The annoying thing with removing features is that The logic is a bit complex but it is only temporary until the release is out. We can remove it immediately after so I wouldn't be too worried about it :) |
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.
I am in favor the change in general.
I am in favor of the two step (deprecation + removal) process. While not directly related, I think #2971 is a good data point for the argument that configuring rust-libp2p features is hard. Thus I think making it easier for users at the expense of complexity on our end makes sense.
Before we merge here, can you create a second pull request removing the deprecated modules. Once this is merged and released, we can then merge the second pull request.
Done here: #3001 |
Description
Typically, an application will only use one kind of executor like
tokio
orasync-std
. Currently, users of libp2p need to activate a separate feature for each sub-crate that is specific to the executor they want to use, i.e.tcp-tokio
,dns-tokio
, etc.With this PR, we deprecate these features in favor of a single
tokio
andasync-std
feature. Thanks to cargo's support for weak-features, we can forward the respective executor feature to each sub-crate without pulling them in as dependencies unless the user also activated the corresponding protocol (dns
,tcp
etc).Deprecation warnings don't work on re-exports so I had to (temporarily) define a new module in
lib.rs
. This module should be removed again once we actually remove the deprecated features.Here is a screenshot of the warning being active:
This is a backwards-compatible change.
The warning goes away as soon as we stop using the deprecated feature:
Links to any relevant issues
Open Questions
Change checklist
I have added tests that prove my fix is effective or that my feature works