Skip to content

Commit

Permalink
Add documentation for `--extract-doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 19, 2024
1 parent 826054d commit 0b006d4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/doc/rustdoc/src/unstable-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 0b006d4

Please sign in to comment.