#[cfg(doc)]
does not work in Cargo.toml
#11570
Labels
A-cfg-expr
Area: Platform cfg expressions
A-target-dependencies
Area: [target.'cfg(foo)'.dependencies]
C-bug
Category: bug
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: