Skip to content

Fix cfg checks when compiled with --target #207

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

Closed
wants to merge 2 commits into from

Conversation

elichai
Copy link

@elichai elichai commented Dec 19, 2019

Hi,
Since the docs.rs update[1] the docs here don't compile.[2]
it seems like this is happening because now the build command also pass --target x86_64-unknown-linux-gnu which makes the conditional compilations in the build script not work correctly.

From the cargo reference[3] it seems like the solution is to use the environment variable CARGO_CFG_<cfg> instead of the cfg macro.

This PR does it and adds to travis a test that mimics the docs.rs configuration [4]

If this somehow a bug and not a feature in cargo or something I'm missing would love to know :)

[1] https://blog.rust-lang.org/2019/09/18/upcoming-docsrs-changes.html
[2] https://docs.rs/crate/proc-macro2/1.0.6/builds
[3] https://doc.rust-lang.org/cargo/reference/environment-variables.html
[4] https://docs.rs/about

@elichai
Copy link
Author

elichai commented Dec 30, 2019

@alexcrichton @dtolnay So what do you guys think?
The docs are down for a while...
is this a bug that should be fixed in cargo instead?

@dtolnay
Copy link
Owner

dtolnay commented Dec 30, 2019

I believe rust-lang/docs.rs#534 is intended to fix this in docs.rs. I will give it a couple more days to get reviewed before pursuing a workaround.

@dtolnay
Copy link
Owner

dtolnay commented Jan 5, 2020

@dtolnay dtolnay closed this Jan 5, 2020
@elichai
Copy link
Author

elichai commented Jan 6, 2020

ha, they just removed the --target ....
technically the problem is still there but I guess it doesn't matter because procmacro2_semver_exempt is only meant for the docs
https://docs.rs/crate/proc-macro2/1.0.7/builds/209522

@jyn514
Copy link

jyn514 commented Jan 7, 2020

If this somehow a bug and not a feature in cargo or something I'm missing would love to know :)

See rust-lang/cargo#4423, rust-lang/cargo#7677 for the upstream bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants