Skip to content

Commit ff979fd

Browse files
Add documentation for `--extract-doctests
1 parent 826054d commit ff979fd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -664,3 +664,22 @@ Similar to cargo `build.rustc-wrapper` option, this flag takes a `rustc` wrapper
664664
The first argument to the program will be the test builder program.
665665

666666
This flag can be passed multiple times to nest wrappers.
667+
668+
### `--extract-doctests`: outputs doctests in JSON format
669+
670+
* Tracking issue: [#134529](https://github.com/rust-lang/rust/issues/134529)
671+
672+
When this flag is used, it outputs the doctests original source code alongside information
673+
such as:
674+
675+
* File where they are located.
676+
* Line where they are located.
677+
* Codeblock attributes (more information about this [here](./write-documentation/documentation-tests.html#attributes)).
678+
679+
The output format is JSON.
680+
681+
Using this flag looks like this:
682+
683+
```bash
684+
$ rustdoc -Zunstable-options --extract-doctests src/lib.rs
685+
```

0 commit comments

Comments
 (0)