Skip to content
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

rustdoc should also be passed RUSTFLAGS #4737

Closed
nox opened this issue Nov 22, 2017 · 3 comments
Closed

rustdoc should also be passed RUSTFLAGS #4737

nox opened this issue Nov 22, 2017 · 3 comments

Comments

@nox
Copy link
Contributor

nox commented Nov 22, 2017

I know about RUSTDOCFLAGS, but I would like to understand the rationale against passing RUSTFLAGS to rustdoc when running cargo test.

My use case is the following: I'm using unstable Rust code in a 1.0 crate, and I want to cfg-gate it like Rayon does with RUSTFLAGS="--cfg rayon_unstable". It works great, but my issue is that some code that is now using unstable Rust is tested through doc tests and given rustdoc isn't passed RUSTFLAGS, putting # #![cfg_attr(foo_unstable, feature(some_unstable_feature))] in the doc test does nothing and it fails.

@alexcrichton
Copy link
Member

This unfortunately cannot be done because rustdoc does not support all of rustc's flags, and I think supporting that would be an upstream rust-lang/rust issue.

@nox
Copy link
Contributor Author

nox commented Nov 25, 2017

See rust-lang/rust#46189.

@Kixunil
Copy link

Kixunil commented Jul 28, 2021

Could there be a warning when RUSTFLAGS is set for doc? I just spent a lot of time trying to figure out why it doesn't work for me. Would be nice to at least save others.

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

No branches or pull requests

3 participants