-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
#[cfg(doc)]
does not work in Cargo.toml
#11570
Comments
IIRC, Cargo doesn't pass Here are some related you might be interested in:
Footnotes |
This looks to be one specific case of those covered in #8170. Closing in favor of that issue. If there is a reason we should keep this one open, let us know! |
Hey! I'm working on a library that uses two custom
RUSTFLAGS
to control what it provides for different environments, and those two flags are mutually exclusive. However, I wanted to make sure items from both were available in the documentation produced bycargo doc
, so I followed these instructions and used#[cfg(doc)]
for this. That works excellently, except the dependencies of the crate are also controlled by these custom flags (e.g.[target.'cfg(engine)'.dependencies]
), so I expected to be able to write something like this:However, this doesn't seem to work at all, because I still get all the usual unresolved import errors. Changing this to use another custom flag
clientdoc
, rather than the internaldoc
, and then runningworks perfectly. (Although one of these custom flags is involved with importing traditionally Wasm-specific crates, I am almost certain that this is not the problem.)
I expected that
#[cfg(doc)]
would, like any customRUSTFLAGS
I provide, be applied toCargo.toml
as well as the actual code.Instead, this does not seem to occur, and another custom flag has to be used, which isn't ideal.
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: