Skip to content

Commit e37e81c

Browse files
authoredMar 23, 2020
Rollup merge of #69494 - GuillaumeGomez:stabilize-crate-version, r=ehuss,aleksator,ollie27
Stabilize --crate-version option in rustdoc I don't see any reason to not stabilize it anymore, so let's go! cc @kinnison @ehuss r? @ollie27
2 parents e4d2f74 + da5d03d commit e37e81c

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed
 

‎src/bootstrap/bin/rustdoc.rs

-5
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,7 @@ fn main() {
5252
// Bootstrap's Cargo-command builder sets this variable to the current Rust version; let's pick
5353
// it up so we can make rustdoc print this into the docs
5454
if let Some(version) = env::var_os("RUSTDOC_CRATE_VERSION") {
55-
// This "unstable-options" can be removed when `--crate-version` is stabilized
56-
if !has_unstable {
57-
cmd.arg("-Z").arg("unstable-options");
58-
}
5955
cmd.arg("--crate-version").arg(version);
60-
has_unstable = true;
6156
}
6257

6358
// Needed to be able to run all rustdoc tests.

‎src/bootstrap/doc.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ impl Step for Standalone {
313313
}
314314

315315
let mut cmd = builder.rustdoc_cmd(compiler);
316+
// Needed for --index-page flag
317+
cmd.arg("-Z").arg("unstable-options");
318+
316319
cmd.arg("--html-after-content")
317320
.arg(&footer)
318321
.arg("--html-before-content")
@@ -395,7 +398,7 @@ impl Step for Std {
395398

396399
// Keep a whitelist so we do not build internal stdlib crates, these will be
397400
// build by the rustc step later if enabled.
398-
cargo.arg("-Z").arg("unstable-options").arg("-p").arg(package);
401+
cargo.arg("-p").arg(package);
399402
// Create all crate output directories first to make sure rustdoc uses
400403
// relative links.
401404
// FIXME: Cargo should probably do this itself.
@@ -406,6 +409,8 @@ impl Step for Std {
406409
.arg("rust.css")
407410
.arg("--markdown-no-toc")
408411
.arg("--generate-redirect-pages")
412+
.arg("-Z")
413+
.arg("unstable-options")
409414
.arg("--resource-suffix")
410415
.arg(crate::channel::CFG_RELEASE_NUM)
411416
.arg("--index-page")

‎src/doc/rustdoc/src/command-line-arguments.md

+12
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,15 @@ the same CSS rules as the official `light` theme.
390390
`--check-theme` is a separate mode in `rustdoc`. When `rustdoc` sees the
391391
`--check-theme` flag, it discards all other flags and only performs the CSS rule
392392
comparison operation.
393+
394+
### `--crate-version`: control the crate version
395+
396+
Using this flag looks like this:
397+
398+
```bash
399+
$ rustdoc src/lib.rs --crate-version 1.3.37
400+
```
401+
402+
When `rustdoc` receives this flag, it will print an extra "Version (version)" into the sidebar of
403+
the crate root's docs. You can use this flag to differentiate between different versions of your
404+
library's documentation.

‎src/doc/rustdoc/src/unstable-features.md

-12
Original file line numberDiff line numberDiff line change
@@ -248,18 +248,6 @@ Markdown file, the URL given to `--markdown-playground-url` will take precedence
248248
`--playground-url` and `#![doc(html_playground_url = "url")]` are present when rendering crate docs,
249249
the attribute will take precedence.
250250

251-
### `--crate-version`: control the crate version
252-
253-
Using this flag looks like this:
254-
255-
```bash
256-
$ rustdoc src/lib.rs -Z unstable-options --crate-version 1.3.37
257-
```
258-
259-
When `rustdoc` receives this flag, it will print an extra "Version (version)" into the sidebar of
260-
the crate root's docs. You can use this flag to differentiate between different versions of your
261-
library's documentation.
262-
263251
### `--sort-modules-by-appearance`: control how items on module pages are sorted
264252

265253
Using this flag looks like this:

‎src/librustdoc/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn opts() -> Vec<RustcOptGroup> {
267267
unstable("display-warnings", |o| {
268268
o.optflag("", "display-warnings", "to print code warnings when testing doc")
269269
}),
270-
unstable("crate-version", |o| {
270+
stable("crate-version", |o| {
271271
o.optopt("", "crate-version", "crate version to print into documentation", "VERSION")
272272
}),
273273
unstable("sort-modules-by-appearance", |o| {

‎src/test/rustdoc/crate-version.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
// compile-flags: --crate-version=1.3.37 -Z unstable-options
1+
// compile-flags: --crate-version=1.3.37
22

33
// @has 'crate_version/index.html' '//div[@class="block version"]/p' 'Version 1.3.37'

0 commit comments

Comments
 (0)
Please sign in to comment.