Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo rustdoc should build docs for dependencies #2594

Open
tari opened this issue Apr 20, 2016 · 3 comments
Open

cargo rustdoc should build docs for dependencies #2594

tari opened this issue Apr 20, 2016 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-rustdoc S-needs-team-input Status: Needs input from team on whether/how to proceed.

Comments

@tari
Copy link
Contributor

tari commented Apr 20, 2016

The rustdoc subcommand currently only builds documentation for the specified crate, and none of its dependencies. This is different from the behavior of cargo rustc which builds all dependencies (though that is by necessity) and cargo doc which includes all dependencies.

When building for custom targets, it is necessary to use cargo rustdoc to pass -Lpath to allow it to find the system libraries such as libcore. This only documents one crate, however, so getting the same behavior as cargo doc requires multiple invocations of cargo rustdoc with some glue logic to find dependencies.


Alternate approach that would also fix my issue: accept a RUSTDOCFLAGS environment variable similar to how RUSTFLAGS is currently handled. This is a feasible solution if the current limited behavior of cargo rustdoc is desired.

@alexcrichton
Copy link
Member

Yeah seems like we should build dependency documentation as well (unless --no-deps is passed). I'd also be fine accepting RUSTDOCFLAGS!

@lambda-fairy
Copy link
Contributor

I'd love a RUSTDOCFLAGS option too -- while hacking on my project I was surprised that RUSTFLAGS doesn't affect invocations of rustdoc.

As a workaround, my Makefile creates a wrapper script that calls rustdoc with the appropriate arguments:

doc: $(all_deps)
    mkdir -p target
    printf '#!/bin/sh\nexec rustdoc $$@ -L $(libcore_dir)' > target/rustdoc
    chmod +x target/rustdoc
    RUSTDOC=target/rustdoc RUSTFLAGS='-L $(libcore_dir)' cargo doc --release --target=$(target)

@carols10cents carols10cents added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-rustdoc labels Sep 25, 2017
@Ekleog
Copy link
Contributor

Ekleog commented May 9, 2020

I'll just allow myself to poke this issue, as it's been without a message for ~4 years :)

@epage epage added the S-triage Status: This issue is waiting on initial triage. label Sep 28, 2023
@epage epage added S-needs-team-input Status: Needs input from team on whether/how to proceed. and removed S-triage Status: This issue is waiting on initial triage. labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-rustdoc S-needs-team-input Status: Needs input from team on whether/how to proceed.
Projects
None yet
Development

No branches or pull requests

6 participants