Pass doc
cfg to rustc when running cargo doc
#12533
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-triage
Status: This issue is waiting on initial triage.
Problem
From the issue originally reported to rustdoc by @notriddle:
I tried this code:
I expected to see this happen: I expected doc_only_method to appear in crate b
Instead, this happened: It didn't.
Proposed Solution
Rustdoc adds the
doc
cfg before generating the docs for a crate (here), but the metadata from dependencies are generated using rustc without such flag, causing the problem above.cargo doc
should add the cfg to the rustc calls that generate the metadata passed to rustdoc.Notes
A few possibly related issues:
--cfg doc
for build scripts #8944#[cfg(doc)]
does not work inCargo.toml
#11570The text was updated successfully, but these errors were encountered: