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

Link no-deps documentation with no html_root_url to docs.rs by default #42301

Open
dtolnay opened this Issue May 29, 2017 · 3 comments

Comments

Projects
None yet
5 participants
@dtolnay
Copy link
Member

dtolnay commented May 29, 2017

As of Rust 1.19.0-nightly, documenting a crate with cargo doc --no-deps will link to the html_root_url of any dependencies that have one set, and other dependencies will not be linked.

selection_056

In the screenshot, the crate providing HasHtmlRootUrl has an html_root_url so the type is linked. The crate providing NoHtmlRootUrl does not have an html_root_url so the type is not linked.

Linking NoHtmlRootUrl to docs.rs would be a reasonable fallback.

@lnicola

This comment has been minimized.

Copy link
Contributor

lnicola commented Nov 10, 2017

rustdoc can't check (presumably) that the crate really exists on docs.rs. Would it be reasonable to simply link to a page that might 404?

@lnicola

This comment has been minimized.

Copy link
Contributor

lnicola commented Nov 15, 2017

I tried to look into this, but I couldn't figure out how to get the crate versions. The best I managed to do was linking to https://docs.rs/crate/*/crate, which loads the latest version (I assume). Of course, it won't work if the crate is not published, or if the versions are different.

Any other ideas?

@natemara

This comment has been minimized.

Copy link

natemara commented Dec 11, 2018

It seems like possibly, rustdoc could get the version information from the Cargo.toml of the package, and make a request to https://docs.rs/crate/version/crate, and if it comes back with a 200, include a docs.rs link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.