-
Notifications
You must be signed in to change notification settings - Fork 121
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
Use feature cfg outside macro #27
Conversation
I unfortunately had to mark the second doctest as ignore, it fails without the const_fn feature flag but I have no way to access the "nightly" feature flag from within the doctest to make it conditional. |
cfg(feature="nightly") was being evaluated within the crate using the lazy_static! macro. Instead we generate different macros depending on the cfg. Signed-off-by: Dan Schatzberg <schatzberg.dan@gmail.com>
I suppose this conflicts with #32. Is it bad for the BTW: since rust-lang/rust#30372 was fixed, |
Now that config attributes can be checked inside doc tests, the nightly tests will pass. Signed-off-by: Dan Schatzberg <schatzberg.dan@gmail.com>
The problem is that the "nightly" config attribute is defined for the lazy-static crate, not the invoking crate. So checking the attribute inside the macro (which is evaluated inside the invoking crate) doesn't make sense. This change uses the attribute to generate a different macro altogether. Thanks for the note on the doc test. It is now unignored |
Yes, you're right. i guess nobody noticed until now because everyone names their nightly feature "nightly" :) |
I'm not sure defining the I don't believe we can specify conditional features based upon other features in [dependencies]
lazy_static = { version = "..", features = if nightly then ["nightly"] else [] }
[features]
nightly = [] |
@compressed actually you can do that: [dependencies]
lazy_static = "*"
[features]
nightly = ["lazy_static/nightly"] Documented here but only in the code sample. |
@durka oh awesome, that's perfect then. Yeah, I didn't spot that in the docs when I was going through, thanks! 👍 |
Hi, very very sorry for the long delay! I incorporated the changes here into master. I didn't merge directly due to wanting to incoperate other PR's as well, and they all started to cause merge conflicts with each other. :P Could you check if I missed something and then close this PR? Note that current master is not yet a published cargo version since my computer literally broke while preparing the commits for this, and I'm still in the process of recovering. |
Looks good. Thank you! Hope you recover your machine. |
Thanks! Seems to have all worked out so far. I'll publish the changes as v0.2 on crates.io now. |
cfg(feature="nightly") was being evaluated within the crate using the
lazy_static! macro. Instead we generate different macros depending on
the cfg.