Rollup merge of #44989 - QuietMisdreavus:what-is-your-quest, 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 #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.)
This commit is contained in:
kennytm 2017-10-12 16:14:22 +08:00
commit 445bbde784
No known key found for this signature in database
GPG key ID: FEF6C8051D0E013C
7 changed files with 57 additions and 1 deletions

View file

@ -112,6 +112,7 @@ impl<T: Clean<U>, U> Clean<Vec<U>> for P<[T]> {
#[derive(Clone, Debug)]
pub struct Crate {
pub name: String,
pub version: Option<String>,
pub src: PathBuf,
pub module: Option<Item>,
pub externs: Vec<(CrateNum, ExternalCrate)>,
@ -183,6 +184,7 @@ impl<'a, 'tcx> Clean<Crate> for visit_ast::RustdocVisitor<'a, 'tcx> {
Crate {
name,
version: None,
src,
module: Some(module),
externs,