Closed gnzlbg closed 5 years ago
@alexcrichton this makes it easy to use cfg-if in libstd, not that copy-pasting it is a big deal, but making this crate no_core
is trivial (it should probably be no_core
by default, but right now the feature is unstable).
Could you do a release once this is merged ?
Thanks but I personally do not want to maintain this. This is a tiny macro that basically never changes, so copy/pasting it into libcore/libstd/etc seems fine for now. If we need to deduplicate in libstd for whatever reason then there's a way to do that (aka the other examples of crates. that libstd depends on)
This is a tiny macro that basically never changes,
FWIW, the definition in this crate is completely different from the one in libstd =/
I am wary of libraries like stdsimd using this crate on travis when running their tests (and when released on crates.io), and a completely different macro on libstd.
It's the same macro, just reorganized. The purpose of this macro hasn't really changed since day 1, so the user-facing interface is always the same.
I don't mind, I'll rebase the PR to update stdsimd to not add cfg-if to std as a dependency (with this patch it just worked, no hacks required).
So libstd, stdsimd, libc, and now hashbrown might need to copy-paste this macro. Making this crate #[no_core]
would allow using it everywhere and it would just work fine on all dependencies of libstd.
I don't really personally want to keep up to date with changes to #![no_core]
and keep publishing versions of this crate that continue to work on nightly. If I could go back in time I sort of wish I "published" this crate as a gist because it really is a tiny macro that is basically harmless to copy around, if it works for you great and if it doesn't users can always feel free to update the macro
I can maintain that if you want, but I see your point. @SimonSapin suggested that we should consider exporting this from libcore. I don't know how I feel about that, but it would be an option.
I don't personally have an opinion on exporting this from libcore per se, although I wouldn't be oppposed!
This PR adds a cargo feature for this crate called
use_core
- this feature is enabled by default and builds the library with libcore (using the#![no_std]
attribute).When this feature is disabled, the crate is built with
#![no_core]
instead.