Add cargo rustdoc for passing arbitrary flags to rustdoc#1977
Add cargo rustdoc for passing arbitrary flags to rustdoc#1977Manishearth wants to merge 6 commits into
cargo rustdoc for passing arbitrary flags to rustdoc#1977Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
conceputally, 👍 from me. |
There was a problem hiding this comment.
I think this may want to customize this text instead of just copy/pasting from cargo help doc, for example this should probably start out by saying that it is intended to configure the invocation of rustdoc on one crate and not mention much about dependencies up here at the top.
|
sgtm |
|
So, I actually want the subcommand to pass the rustdoc flags to all dependencies. Rustdoc output would be weird if only one crate was compiled with a set of flags. For I thought this PR did do that, turns out it doesn't, I'll see if I can make it work so that the args are passed to upstream deps too. (This is why I didn't add a check for multiple targets -- this should behave exactly like cargo doc, just that every rustdoc invocation gets the extra flags) |
|
I would personally not want to land this with subtly different behavior than Configuration of rustdoc for all crates in the dependency graph is certainly desired, but I think that wants a more principled solution than just an extra command which passes all the flags everywhere. E.g. this is a recipe for all projects having their documentation building step be something like |
|
Alright, fixed so that it mirrorrs rustc
So there are multiple use cases here. One is for the default build, and one is for specialized builds. For example, I'd prefer if we had both a cargo-config based solution, and a terminal-based solution. The simplest one seems to be allowing |
|
Yes I agree that passing custom flags shouldn't always involve editing files, but I was mostly just saying that this should follow |
There was a problem hiding this comment.
Cargo tends to favor Vec::new() over vec![] currently
|
(addressed) |
|
☔ The latest upstream changes (presumably #1991) made this pull request unmergeable. Please resolve the merge conflicts. |
Quite useful for doing
cargo rustdoc -- --no-defaultsto get a doc package with private items.This is similar to
cargo rustc, except that the flags passed tocargo rustdocare applied to both the main package and dependencies.A friend of mine was looking for this feature, couldn't find a way to do it without directly calling rustdoc. This would probably be useful for using the full configurability of rustdoc in cargo-applications.
r? @alexcrichton