From 0b006d4514a221ea63716c5c013273596d8b8848 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 19 Dec 2024 20:03:02 +0100 Subject: [PATCH] Add documentation for `--extract-doctests --- src/doc/rustdoc/src/unstable-features.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index f19c3a51f619b..f7496c9b1f380 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -664,3 +664,22 @@ Similar to cargo `build.rustc-wrapper` option, this flag takes a `rustc` wrapper The first argument to the program will be the test builder program. This flag can be passed multiple times to nest wrappers. + +### `--extract-doctests`: outputs doctests in JSON format + + * Tracking issue: [#134529](https://github.com/rust-lang/rust/issues/134529) + +When this flag is used, it outputs the doctests original source code alongside information +such as: + + * File where they are located. + * Line where they are located. + * Codeblock attributes (more information about this [here](./write-documentation/documentation-tests.html#attributes)). + +The output format is JSON. + +Using this flag looks like this: + +```bash +$ rustdoc -Zunstable-options --extract-doctests src/lib.rs +```