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

rustdoc and linking to stdlib docs #35183

Closed
eminence opened this issue Aug 2, 2016 · 5 comments
Closed

rustdoc and linking to stdlib docs #35183

eminence opened this issue Aug 2, 2016 · 5 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@eminence
Copy link
Contributor

eminence commented Aug 2, 2016

  • Observation: Running rustup doc is great and works wonderfully.
  • Observation: The docs hosted on rust-lang.org are Unix only. Windows-only types are no-where to be found.
  • Observation: After running cargo doc and viewing local docs, any links to stdlib types are redirected to the rust-lang.org hosted docs, and so links to Windows-only types are 404 not found

Problem: How to view the correct version of stdlib docs?

For example, reading the docs for AsRawFd you see this:

This is only available on unix platforms and must be imported in order to call the method. Windows platforms have a corresponding AsRawHandle and AsRawSocket set of traits.

But if you try to search for AsRawSocket, there are no results, which is kinda frustrating.

So my first thought was: how to remove the frustration of Unix-only docs on rust-lang.org? I don't have a proposal for this yet.

But my second thought was this: If rustup knows the path to the stdlib docs, could this path be passed to rustdoc, so that rustdoc can use local stdlib docs, instead of rust-lang.org docs? This should be an optional mode, since a very common use case is to use rustdoc to generated docs to be hosted somewhere (like github pages), and in this case, linking to rust-lang.org docs would make more sense.

What do you all think?

@eminence
Copy link
Contributor Author

eminence commented Aug 2, 2016

Half dup of #1998

@steveklabnik steveklabnik added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Aug 2, 2016
@steveklabnik steveklabnik added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 25, 2017
@QuietMisdreavus
Copy link
Member

Update: Thanks to #43348, the Windows docs are now hosted on rust-lang.org, and https://doc.rust-lang.org/nightly/std/os/windows/io/trait.AsRawSocket.html is searchable and linkable.

However, the other half of the issue (about local cargo doc being able to link to std docs downloaded by rustup) is still valid, and something that's possible now. #51384 added a flag to rustdoc to override the URL set by a crate's own #![doc(html_root_url)], so a flag could be added to cargo to pass these flags to rustdoc when generating docs locally. @rust-lang/cargo, do you think this functionality would be desired?

@ehuss
Copy link
Contributor

ehuss commented Nov 7, 2018

@QuietMisdreavus I think it sounds interesting. I opened an issue at rust-lang/cargo#6279 to track the feature request. Feel free to add to it or correct anything that I may have misinterpreted. The team is currently doing long-term planning and may be a little busy in the short term, and I'm not aware of anyone who would push it forward right now. But we can definitely talk about it more.

@ehuss
Copy link
Contributor

ehuss commented Jul 15, 2020

There is now an experimental flag in cargo called -Zrustdoc-map that offers some config options for controlling where links go (rust-lang/cargo#8296). For linking directly to the local std docs, the following may be placed in any cargo config file:

[doc.extern-map]
std = "local"

More details in the docs: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#rustdoc-map

@jyn514
Copy link
Member

jyn514 commented Nov 4, 2020

Closing this in favor of rust-lang/cargo#8296, rustdoc can't do this on its own.

@jyn514 jyn514 closed this as completed Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants