about summary refs log tree commit diff
path: root/src/doc/rustdoc
diff options
context:
space:
mode:
authorMark Simulacrum <mark.simulacrum@gmail.com>2018-04-01 18:04:54 +0200
committerGitHub <noreply@github.com>2018-04-01 18:04:54 +0200
commit5d3916d5668cf79430ff64e66bce15bcfcede6aa (patch)
treea14f0ff7f4502d4a35a956fc5386b0a56df80ef7 /src/doc/rustdoc
parentd2235f20b5295394450f4962fb5f93254e63640c (diff)
parent97aead0c6c1e3e7e5c442f729c441d31e66342d2 (diff)
downloadrust-5d3916d5668cf79430ff64e66bce15bcfcede6aa.tar.gz
rust-5d3916d5668cf79430ff64e66bce15bcfcede6aa.zip
Rollup merge of #49451 - QuietMisdreavus:epoch-doctests, r=GuillaumeGomez
rustdoc: add an --edition flag to compile docs/doctests with a certain edition

To correspond with the 2018 edition, this adds a (currently unstable) `--edition` flag to rustdoc that makes it compile crates and doctests with the given edition. Once this lands, Cargo should be updated to pass this flag when the edition configuration option is given.
Diffstat (limited to 'src/doc/rustdoc')
-rw-r--r--src/doc/rustdoc/src/unstable-features.md13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md
index 44b9145a8c2..bf97fb46861 100644
--- a/src/doc/rustdoc/src/unstable-features.md
+++ b/src/doc/rustdoc/src/unstable-features.md
@@ -348,6 +348,19 @@ details.
 
 [issue-display-warnings]: https://github.com/rust-lang/rust/issues/41574
 
+### `--edition`: control the edition of docs and doctests
+
+Using this flag looks like this:
+
+```bash
+$ rustdoc src/lib.rs -Z unstable-options --edition 2018
+$ rustdoc --test src/lib.rs -Z unstable-options --edition 2018
+```
+
+This flag allows rustdoc to treat your rust code as the given edition. It will compile doctests with
+the given edition as well. As with `rustc`, the default edition that `rustdoc` will use is `2015`
+(the first edition).
+
 ### `-Z force-unstable-if-unmarked`
 
 Using this flag looks like this: