Skip to content

Add --document-hidden-items flag to cargo doc #8001

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

Closed
wants to merge 2 commits into from

Conversation

xiongmao86
Copy link
Contributor

This pr try to fix #7766.

The --document-hidden-item is unstable, so -Z unstable-options is needed, but I am not sure that I handle it right.

I run cargo test on nightly, a few tests failed. I not sure how to refer to it. Post the message on comment?

@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 @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. 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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 15, 2020
@@ -55,6 +56,9 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
};
let mut compile_opts =
args.compile_options(config, mode, Some(&ws), ProfileChecking::Checked)?;
if args.is_present("document-hidden-items") {
compile_opts.local_rustdoc_args = Some(vec!["-Z".to_string(), "unstable-options".to_string(), "--document-hidden-items".to_string()]);
Copy link
Contributor Author

@xiongmao86 xiongmao86 Mar 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I have handle -Z unstable-options correctly here.

@ehuss ehuss changed the title Fixes Issue7766 Add --document-hidden-items flag to cargo doc Mar 15, 2020
@ehuss
Copy link
Contributor

ehuss commented Mar 15, 2020

@xiongmao86 It's generally best to include a descriptive title in the PR (I have updated it).

As for handling unstable features, in this case Cargo should only accept the flag if -Zunstable-options is passed. Typically this is done by calling CliUnstable.fail_if_stable_opt. There are a few examples of that in the code base.

As a bigger question, why add this when it is unstable? I would prefer to stabilize it in rustdoc before adding it to Cargo. Is there anything blocking it being stabilized in rustdoc?

For @rust-lang/cargo I'd also like to have a conversation about how we want to handle rustdoc flags. Rustdoc has a lot of flags, should we replicate most of them as-is in cargo doc? Some (like --crate-version or --extern-html-root-url) make sense for Cargo to handle internally. Where do we draw the line of "this must be passed with RUSTDOCFLAGS" and "Cargo will forward this flag for you"?

@xiongmao86
Copy link
Contributor Author

xiongmao86 commented Mar 16, 2020

@ehuss, Thank you for reviewing my pr.

As a bigger question, why add this when it is unstable?

It is available in the "good first issue" page, I didn't reflect on the unstable option thing. So, should I proceed, or should I just abandon this pr?

@ehuss
Copy link
Contributor

ehuss commented Mar 16, 2020

It is available in the "good first issue" page,

I'm curious what page is this? It shouldn't be linking to random issues here.

If this isn't something you specifically wanted, then it would probably be best to close it. We have a number of issues tagged with "help wanted" here: https://github.com/rust-lang/cargo/issues?q=is%3Aopen+is%3Aissue+label%3AE-help-wanted. If any of those look interesting, feel free to claim one, and ask any questions you have on getting started.

@xiongmao86
Copy link
Contributor Author

xiongmao86 commented Mar 16, 2020

I'm curious what page is this? It shouldn't be linking to random issues here.

In the issues page there is a link "we have collected some good first issue for you", click the link a page with issues for newbies or first comers will appear. That is what I described as "good first issue" page. I don't know how issues go there, but could be chosen by hand.

P.s. the message that contained the link could be dismissed in that case the link will no show.

@ehuss
Copy link
Contributor

ehuss commented Mar 16, 2020

Strange, I've never seen that feature before! Apparently GitHub uses some machine learning system to try to guess which issues to list, and I don't see a way to turn it off. Perhaps it can be influenced with the "good first issue" label?

@xiongmao86
Copy link
Contributor Author

xiongmao86 commented Mar 16, 2020

It is a recent feature indeed, "good first issue" is labeled some month ago, now this label seem to be abandoned, replace by this feature. I have never imagine machine learning could come this far.

Since this is not a good first issue, I am closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --document-hidden-items flag to cargo doc
4 participants