diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-02-26 22:08:59 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2020-02-26 22:08:59 +0100 |
| commit | c57de34e8feca218c0c696b621de87c078a2a0e0 (patch) | |
| tree | 21952731b2910e3d1d6a27c0fcf4622d607f557d | |
| parent | abc3073c92df034636a823c5382ece2186d22b9e (diff) | |
| download | rust-c57de34e8feca218c0c696b621de87c078a2a0e0.tar.gz rust-c57de34e8feca218c0c696b621de87c078a2a0e0.zip | |
Stabilize --crate-version option in rustdoc
| -rw-r--r-- | src/bootstrap/bin/rustdoc.rs | 5 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/command-line-arguments.md | 12 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/unstable-features.md | 12 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/crate-version.rs | 2 |
5 files changed, 14 insertions, 19 deletions
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index 04345867bf5..ba644e61118 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -52,12 +52,7 @@ fn main() { // Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick // it up so we can make rustdoc print this into the docs if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") { - // This "unstable-options" can be removed when `--crate-version` is stabilized - if !has_unstable { - cmd.arg("-Z").arg("unstable-options"); - } cmd.arg("--crate-version").arg(version); - has_unstable = true; } // Needed to be able to run all rustdoc tests. diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index 2e32ce31eca..f09192a53ba 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -390,3 +390,15 @@ the same CSS rules as the official `light` theme. `--check-theme` is a separate mode in `rustdoc`. When `rustdoc` sees the `--check-theme` flag, it discards all other flags and only performs the CSS rule comparison operation. + +### `--crate-version`: control the crate version + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs --crate-version 1.3.37 +``` + +When `rustdoc` receives this flag, it will print an extra "Version (version)" into the sidebar of +the crate root's docs. You can use this flag to differentiate between different versions of your +library's documentation. diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index a48526d39fd..7bc70a206ee 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -269,18 +269,6 @@ Markdown file, the URL given to `--markdown-playground-url` will take precedence `--playground-url` and `#![doc(html_playground_url = "url")]` are present when rendering crate docs, the attribute will take precedence. -### `--crate-version`: control the crate version - -Using this flag looks like this: - -```bash -$ rustdoc src/lib.rs -Z unstable-options --crate-version 1.3.37 -``` - -When `rustdoc` receives this flag, it will print an extra "Version (version)" into the sidebar of -the crate root's docs. You can use this flag to differentiate between different versions of your -library's documentation. - ### `--sort-modules-by-appearance`: control how items on module pages are sorted Using this flag looks like this: diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index eab88b7165d..2aa9c0ce01b 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -266,7 +266,7 @@ fn opts() -> Vec<RustcOptGroup> { unstable("display-warnings", |o| { o.optflag("", "display-warnings", "to print code warnings when testing doc") }), - unstable("crate-version", |o| { + stable("crate-version", |o| { o.optopt("", "crate-version", "crate version to print into documentation", "VERSION") }), unstable("sort-modules-by-appearance", |o| { diff --git a/src/test/rustdoc/crate-version.rs b/src/test/rustdoc/crate-version.rs index 9ea84ac0312..893af5c6133 100644 --- a/src/test/rustdoc/crate-version.rs +++ b/src/test/rustdoc/crate-version.rs @@ -1,3 +1,3 @@ -// compile-flags: --crate-version=1.3.37 -Z unstable-options +// compile-flags: --crate-version=1.3.37 // @has 'crate_version/index.html' '//div[@class="block version"]/p' 'Version 1.3.37' |
