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

Show library version in documentation generated by rustdoc #24336

Closed
gsingh93 opened this issue Apr 11, 2015 · 8 comments
Closed

Show library version in documentation generated by rustdoc #24336

gsingh93 opened this issue Apr 11, 2015 · 8 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. 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

@gsingh93
Copy link
Contributor

I recently was using a library whose online documentation was out of date. One of the method signatures had changed and that wasn't reflected in the documentation. I checked the source code of the project to confirm that the signature had changed, but it also would have been nice to see on the documentation page that the version I was using didn't match up to the documentation version.

@tomjakubowski
Copy link
Contributor

There will need to be some coordination with cargo because "crate versions" are not something even rustc knows about.

@tomjakubowski
Copy link
Contributor

The --html-after-content argument might be useful.

@steveklabnik steveklabnik added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 13, 2015
@bluss
Copy link
Member

bluss commented Sep 11, 2015

cargo issue: rust-lang/cargo/issues/1681

@steveklabnik
Copy link
Member

Triage: no change.

docs.rs kinda does this.

@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
@QuietMisdreavus
Copy link
Member

From the info in rust-lang/cargo#1681 (comment), a "quick" patch for this would involve checking env::var("CARGO_PKG_VERSION"), and if it's Ok, finding a good place in the page template to put it. For bonus points, you could also check env::var("CARGO_PKG_NAME") to put both the crate name and version all over the place.

The major drawback to this would be that it codifies it around Cargo, rather than making it some kind of neutral setup that could easily be pulled out into other build systems. It's still just a couple environment variables, but they also have "Cargo" in the name. >_> A "proper" solution likely involves adding new command-line options and making Cargo use them, and this is possibly RFC territory? cc @rust-lang/dev-tools, i want to double-check my reasoning.

@GuillaumeGomez
Copy link
Member

@QuietMisdreavus: Your logic seems ok. I just don't find this very useful but why not...

@QuietMisdreavus
Copy link
Member

We talked about this in today's dev-tools meeting, and we figured that adding new command-line flags for this won't require an RFC. I'd like to make a first-pass PR that adds them as unstable flags so we can hash out the particulars within that thread.

@QuietMisdreavus
Copy link
Member

That PR is live at #44989.

kennytm added a commit to kennytm/rust that referenced this issue Oct 12, 2017
… r=GuillaumeGomez

let rustdoc print the crate version into docs

This PR adds a new unstable flag to rustdoc, `--crate-version`, which when present will add a new entry to the sidebar of the root module, printing the given version number:

![Screenshot of a test crate, showing "Version 1.3.37" under the crate name](https://user-images.githubusercontent.com/5217170/31104096-805e3f4c-a7a0-11e7-96fc-368b6fe063d6.png)

Closes rust-lang#24336

(The WIP status is because i don't want to merge this until i can get the std docs to use it, which i need help from rustbuild people to make sure i get right.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. 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