Skip to content

doc: RUSTDOCFLAGS and --target is not passed to rustdoc when documenting proc-macros with a --target set #7677

@QuietMisdreavus

Description

@QuietMisdreavus

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

  1. Start with a proc-macro crate.
  2. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cross-compilingArea: using --target flag for other platformsC-bugCategory: bugCommand-docS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions