-
Notifications
You must be signed in to change notification settings - Fork 341
Put everything behind a 'stable' feature to avoid future breaking changes #434
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
src/lib.rs
Outdated
@@ -49,33 +49,46 @@ | |||
#![doc(html_logo_url = "https://async.rs/images/logo--hero.svg")] | |||
#![recursion_limit = "2048"] | |||
|
|||
#[macro_use] | |||
mod utils; | |||
/// Declares stable items. |
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.
Can you move this macro into utils.rs
to group all these macros together?
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.
Or, alternatively, I believe you can just put this in lib.rs
:)
#![cfg(feature = "stable")]
I think this idea is worthwhile for us to introduce other features down the line (such as a subset of async-std that does not build the runtime). I'm not sure what the right name is, but I like the name |
@yoshuawuyts I like that idea! I believe this whole PR can be reduced to (seems to work for me!):
If we add new features like #![cfg(any(feature = "default", feature = "runtime", feature = "core"))] |
@stjepang @yoshuawuyts How about now? |
Looks good to me but I've never seen a crate do this before. Do we know someone more familiar with Cargo who could take a quick look? |
I recently confirmed this behavior when working on cargo-hack: https://github.com/taiki-e/cargo-hack/blob/75bff8d3c45e72e2075daf998b7dd179c8f7848c/src/main.rs#L243-L246 // run with no default features if the package has other features
//
// `default` is not skipped because `cfg(feature = "default")` is work
// if `default` feature specified. EDIT: However, I have never seen a crate doing this other than a crate for testing :) |
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'm approving but it would be good for someone else to also approve before merging.
This fixes #417, although I don't know if this is the ideal way, can anybody point me the best way?
I had to define the macro in
lib.rs
otherwise everything else onutil.rs
would have to be behind the same macro, I could move it toutils.rs
tho.Also, since things on
unstable
seem to depend onstable
(does it really need to?). So for nowunstable
needsstable
, that could become a problem when specific features are added, since you may need to play feature hide and seek with them to use theunstable
features. What do you guys think about that?If we put only the pub exports behind the flag a bunch of "unused" warnings will pop up, is it better than putting everything behind the flag (it may fix the
unstable
problem)? Should we just add aallow(unused)
?And for some weird reason
prelude.rs
stopped compiling referencing this PR rust-lang/rust#52234, which seems like a problem so I removed thepub use
, specially because now the macro won't be in the prelude. Any ideas on that? (this actually breaks a test, what is the best way to fix it?)