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

Add document-private-items flag to cargo doc #5543

Merged
merged 3 commits into from
Jul 16, 2018

Conversation

roblabla
Copy link
Contributor

Add a --document-private-items flag to cargo doc, that mimics the equivalent cargo rustdoc -- --document-private-items. This works by relaying the flag to the underlying rustdoc call.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matklad (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. Due to 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.

@matklad
Copy link
Member

matklad commented May 28, 2018

Could this be handled by using cargo rustdoc -- --document-private-itmes?

@matklad matklad added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label May 28, 2018
@roblabla
Copy link
Contributor Author

roblabla commented May 28, 2018

I tried to use it, but couldn't figure out how to make it work. Reason is, I'm using xargo and my crate only compiles for a specific target (it errors out on others). So to document it, I need the ability to specify a specific target, e.g. xargo doc --target=i386-unknown-none. Doing so, I lose the ability to document private items, hence the feature request. xargo rustdoc doesn't work because I can't specify a target, and using rustdoc itself means I need to specify a sysroot manually...

I'm pretty sure I could somehow figure out the correct sequence of commands to get rustdoc to do what I want, but it seemed easier to just add the ability to document private items in cargo doc.

@matklad
Copy link
Member

matklad commented May 28, 2018

Hm, looks like this is a bug in cargo rustdoc, it should support --target. Filed #5587 for that.

bors added a commit that referenced this pull request May 28, 2018
Support `--target` argument in `cargo rustdoc`

We don't support `--target` in `cargo rustdoc`. Seems like an omission to me? We support it in `cargo rustc`. Discovered in #5543 (comment).
@matklad
Copy link
Member

matklad commented May 28, 2018

@roblabla now cargo rustdoc supports the —target flag. Will it work for your case?

@alexcrichton
Copy link
Member

ping @roblabla, any updates on this PR? It looks like it may be ready to go with a test?

@roblabla
Copy link
Contributor Author

roblabla commented Jul 5, 2018

Yeah, this PR should work (I've been using it in a personal project for a while now). I'll add a test case. I suppose it would go in tests/testsuite/doc.rs ?

@alexcrichton
Copy link
Member

Indeed!

@alexcrichton
Copy link
Member

@roblabla any luck adding the test case?

@roblabla
Copy link
Contributor Author

Alright, sorry for the long wait, I finally got around to adding a proper test case for this.

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Collaborator

bors commented Jul 16, 2018

📌 Commit 7757753 has been approved by alexcrichton

@bors
Copy link
Collaborator

bors commented Jul 16, 2018

⌛ Testing commit 7757753 with merge 06721dd...

bors added a commit that referenced this pull request Jul 16, 2018
Add document-private-items flag to cargo doc

Add a `--document-private-items` flag to `cargo doc`, that mimics the equivalent `cargo rustdoc -- --document-private-items`. This works by relaying the flag to the underlying rustdoc call.
@bors
Copy link
Collaborator

bors commented Jul 16, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 06721dd to master...

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`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants