Put everything behind a 'stable' feature to avoid future breaking changes#434
Conversation
|
|
||
| #[macro_use] | ||
| mod utils; | ||
| /// Declares stable items. |
There was a problem hiding this comment.
Can you move this macro into utils.rs to group all these macros together?
There was a problem hiding this comment.
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 :) |
ghost
left a comment
There was a problem hiding this comment.
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.rsotherwise everything else onutil.rswould have to be behind the same macro, I could move it toutils.rstho.Also, since things on
unstableseem to depend onstable(does it really need to?). So for nowunstableneedsstable, that could become a problem when specific features are added, since you may need to play feature hide and seek with them to use theunstablefeatures. 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
unstableproblem)? Should we just add aallow(unused)?And for some weird reason
prelude.rsstopped 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?)