Add documentation for --check-cfg in rustdoc book · rust-lang/rust@a31ae15 (original) (raw)

Original file line number Diff line number Diff line change
@@ -512,3 +512,17 @@ crate being documented (`foobar`) and a path to output the calls
512 512
513 513 To scrape examples from test code, e.g. functions marked `#[test]`, then
514 514 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`.