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

Provide a way to interpolate crate version in html_root_url #42300

Open
dtolnay opened this issue May 29, 2017 · 5 comments
Open

Provide a way to interpolate crate version in html_root_url #42300

dtolnay opened this issue May 29, 2017 · 5 comments
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@dtolnay
Copy link
Member

dtolnay commented May 29, 2017

In Serde we work around this by having a reminder in Cargo.toml to update the html_root_url when releasing a new version. serde-rs/serde@dc7ab26

[package]
version = "1.0.8" # remember to update html_root_url
#![doc(html_root_url = "https://docs.rs/serde/1.0.8")]

This is annoying and easily falls out of sync. For example mio 0.6.8 docs point to version 0.6.1: tokio-rs/mio#613.

There should be a way to keep these synchronized automatically.

@steveklabnik steveklabnik added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels May 30, 2017
@durka
Copy link
Contributor

durka commented May 30, 2017

Macros in attributes would neatly solve this, just sayin'.

@onur
Copy link
Member

onur commented May 31, 2017

I recently implemented --extern-version argument to rustdoc and cargo for this purpose. I don't think this patches should be in rust or cargo but I am planning to solve all external crate links in docs.rs with this patches. Docs.rs is not using this compiler yet, building rustc for all tier one platforms requires a lot of effort.

Hopefully docs.rs will set html_root_url automatically for all crates soon and it will help maintainers to not care about html_root_url.

@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 27, 2017
@Nadrieril
Copy link
Member

If I'm reading this commit correctly, it appears that docs.rs does it now. This is not documented anywhere though, as far as I can see.

@Nadrieril
Copy link
Member

Apparently that's not enough to not need html_root_url sadly; that seems to depend on #42301

@ehuss ehuss removed the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 18, 2022
@RodBurman
Copy link

I may not have a good understanding of the issue but I think what we would like is the ability to write (something like):

#![doc(html_root_url = "https://docs.rs/serde/{version}")]

Where {version} refers to the value in Cargo.toml (which is available in macros c.f. the clap crate), so it might need to be (say) {Cargo.toml::version} to indicate the source without the compiler needing to just "know" it and thus Cargo.toml being somewhat "magical" (this assumes we may want/need other possible distinguishable sources). Of course #![doc("link")] is an attribute not a macro so this method maybe more easily suggested than coded. Once this substation mechanism is added it may well find a lot of uses elsewhere. Or I maybe talking tosh :(.

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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants