You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
PR rust-lang/rust#53076 added support for #[cfg(doc)], which conditionally enables code when being built for documentation. This cfg is set by rustdoc when parsing a module, but is not set by Cargo when running rustc prior to running rustdoc.
This causes confusing failures to document code when the current platform can't build it, but should be able to document it.
A macOS machine should be able to run cargo doc to build docs, even though the library doesn't support that platform. Currently this fails
To confirm that this is caused by a bad rustc argv, invoke Cargo with RUSTFLAGS="--cfg doc" cargo doc and observe that it builds the docs successfully.
Possible Solution(s)
The best solution would be to pass --cfg doc to rustc when building docs.
Closing; per discussion in #8602, this won't be possible to change without breaking backwards compatibility (and it's unclear whether changing it would even be correct).
Problem
PR rust-lang/rust#53076 added support for
#[cfg(doc)]
, which conditionally enables code when being built for documentation. This cfg is set byrustdoc
when parsing a module, but is not set by Cargo when runningrustc
prior to runningrustdoc
.This causes confusing failures to document code when the current platform can't build it, but should be able to document it.
Steps
Given this library:
A macOS machine should be able to run
cargo doc
to build docs, even though the library doesn't support that platform. Currently this failsTo confirm that this is caused by a bad
rustc
argv, invoke Cargo withRUSTFLAGS="--cfg doc" cargo doc
and observe that it builds the docs successfully.Possible Solution(s)
The best solution would be to pass
--cfg doc
to rustc when building docs.Notes
Output of
cargo version
:The text was updated successfully, but these errors were encountered: