-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Problem
On docs.rs, we've run into an issue (rust-lang/docs.rs#422) where proc-macros were not correctly being documented because of being passed an explicit --target
flag.
Steps
- Start with a proc-macro crate.
- Run
cargo doc --no-deps --target x86_64-unknown-linux-gnu
(substituting your native target or some other target for which you have its std installed)
Expected outcome: Documentation is available in target/x86_64-unknown-linux-gnu/doc
.
Actual outcome: Documentation is available in target/doc
.
The situation gets worse when RUSTDOCFLAGS
is involved; cargo doc
does not pass RUSTDOCFLAGS to rustdoc when documenting a proc-macro with an explicit --target
.
Possible Solution(s)
My preferred solution would be to always handle calls to rustdoc as if they were regular libraries, i.e. give them a --target
, output them into the target-specific directory, etc. The lack of RUSTDOCFLAGS seems like a weird oversight, but given #4423 there may be some crossed wires with rustc and building things that run immediately on the host.
Notes
Docs.rs always runs the latest nightly, but the logs in rust-lang/rust#66796 (comment) were collected with cargo 1.41.0-nightly (750cb1482 2019-11-23)
.