Skip to content

Commit a31ae15

Browse files
committed
Add documentation for --check-cfg in rustdoc book
1 parent 9705939 commit a31ae15

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

+14
Original file line numberDiff line numberDiff line change
@@ -512,3 +512,17 @@ crate being documented (`foobar`) and a path to output the calls
512512

513513
To scrape examples from test code, e.g. functions marked `#[test]`, then
514514
add the `--scrape-tests` flag.
515+
516+
### `--check-cfg`: check configuration flags
517+
518+
This flag accepts the same values as `rustc --check-cfg`, and uses it to check configuration flags.
519+
520+
Using this flag looks like this:
521+
522+
```bash
523+
$ rustdoc src/lib.rs -Z unstable-options \
524+
--check-cfg='names()' --check-cfg='values(feature, "foo", "bar")'
525+
```
526+
527+
The example above check every well known names (`target_os`, `doc`, `test`, ... via `names()`)
528+
and check the values of `feature`: `foo` and `bar`.

0 commit comments

Comments
 (0)