about summary refs log tree commit diff
path: root/src/doc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-01-18 16:18:11 +0000
committerbors <bors@rust-lang.org>2019-01-18 16:18:11 +0000
commitf613dc138b4012cf3d2eb40718fbcc7cf0a34039 (patch)
treed77b35ab334deed793d6a03083ddda21d1ecd9bc /src/doc
parent527b8d424392dd7d89cfaa4dfdaec4df226c8018 (diff)
parentf5413cd1e232837775bd8dfc803af4429e8c89c4 (diff)
downloadrust-f613dc138b4012cf3d2eb40718fbcc7cf0a34039.tar.gz
rust-f613dc138b4012cf3d2eb40718fbcc7cf0a34039.zip
Auto merge of #56189 - rep-nop:keep_doc_test_executable, r=QuietMisdreavus
rustdoc: Add option to persist doc test executables

Fixes #37048.

This is the initial version of the code so the doctest executables can be used for stuff like code coverage (specifically https://github.com/xd009642/tarpaulin/issues/13) the folders it goes into were just a first idea, so any better ones are welcome.

Right now it creates a directory structure like:
```
  given_path/
          |_____ <filename>_rs_<linenum>/
          |_____ ...
          |_____ <filename>_rs_<linenum>/
                 |_____ rust_out

```
I couldn't figure out where it actually outputs the file w/ the name, I suspect its somewhere deeper in the compiler.

It also adds the unstable `--persist-doctests` flag to `rustdoc` that enables this behavior.
Diffstat (limited to 'src/doc')
-rw-r--r--src/doc/rustdoc/src/unstable-features.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md
index 905b0646534..d3eb8cb3d3b 100644
--- a/src/doc/rustdoc/src/unstable-features.md
+++ b/src/doc/rustdoc/src/unstable-features.md
@@ -417,3 +417,15 @@ JavaScript, and font files in a single location, rather than duplicating it once
 (grouping of crate docs generated into the same output directory, like with `cargo doc`). Per-crate
 files like the search index will still load from the documentation root, but anything that gets
 renamed with `--resource-suffix` will load from the given path.
+
+### `--persist-doctests`: persist doctest executables after running
+
+Using this flag looks like this:
+
+```bash
+$ rustdoc src/lib.rs --test -Z unstable-options --persist-doctests target/rustdoctest
+```
+
+This flag allows you to keep doctest executables around after they're compiled or run.
+Usually, rustdoc will immediately discard a compiled doctest after it's been tested, but
+with this option, you can keep those binaries around for farther testing.
\ No newline at end of file