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 links to doc items to the Unstable Book #103548

Open
alercah opened this issue Oct 25, 2022 · 7 comments
Open

Add links to doc items to the Unstable Book #103548

alercah opened this issue Oct 25, 2022 · 7 comments
Assignees
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@alercah
Copy link
Contributor

alercah commented Oct 25, 2022

Currently the Unstable Book has autogenerated library feature links:

let lib_features_str = set_to_summary_str(&unstable_lib_features, "library-features");
but all they do is link to the tracking issue.

It would be very helpful to have them link to all the individual library items gated behind each feature flag.

cc @jyn514 @alice-i-cecile

@jyn514 jyn514 added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. labels Oct 25, 2022
@jyn514
Copy link
Member

jyn514 commented Oct 31, 2022

It turns out the documentation for library features is not actually autogenerated; only the summary page is autogenerated. So this isn't something we can do automatically.

One thing we could try is having a tidy lint that requires a link to doc.rust-lang.org somewhere in each library-features/*.md file. That will be too much work to do all at once though, so it will need to happen a bit at a time. We have some precedent for that with the way tests are being moved out src/test/ui a bit at a time; it would be a good E-easy E-mentor issue.

@Mark-Simulacrum
Copy link
Member

I'm not convinced that manual work here is worth it (even if enforced by tidy). It's likely that it would be relatively painful to put together those URLs, and difficult to actually enforce full consistency with the true section gated by the relevant feature gate.

On the other hand, it seems plausible that this could be easily generated from rustdoc (either built-in or via JSON). I think if we can guarantee the results the value would be nice for e.g. libs-api stabilization reports. But probably tricky to get everything.

@jyn514
Copy link
Member

jyn514 commented Oct 31, 2022

Ok cool! That seems very doable :) here's a hacky prototype:

; jq '.index | to_entries[] | select(.value.attrs[] | contains("c_variadic")) | .value | select(.name != null) | .name' -C $(rustc --print sysroot)/share/doc/rust/json/core.json 
"VaList"
"VaListImpl"
"VaArgSafe"

Rustdoc JSON has some way of finding the path of an item in the crate root I can figure out, and from there I can write a hacky script to add it to all the existing docs, then enforce a more reliable tidy check to make sure it's being added to all new documentation too. Does that sound good?

@jyn514
Copy link
Member

jyn514 commented Oct 31, 2022

Oh oof, another thing I found just now is that some library features are missing a page in the book at all. c_variadic, the example I used just now, has a language feature page but no library feature page. That definitely seems like something we should add a tidy check for.

@jyn514
Copy link
Member

jyn514 commented Oct 31, 2022

Ok, I am not personally going to have time to follow up on this. Here's some WIP code that starts on parsing the JSON output of rustdoc: https://github.com/rust-lang/rust/compare/master...jyn514:rust:stability-checks?expand=1

The next steps are:

@rustbot label +E-medium +E-mentor

@rustbot rustbot added the E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. label Oct 31, 2022
@albertlarsan68
Copy link
Member

@rustbot claim

In a week or so, I will have some time to kill.

@albertlarsan68
Copy link
Member

There are many library features that are undocumented, I now detect them (by panicking on file missing).
I will continue working on that, it is in #106681.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools E-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

No branches or pull requests

5 participants