diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rustc/src/SUMMARY.md | 1 | ||||
| -rw-r--r-- | src/doc/rustc/src/check-cfg.md (renamed from src/doc/unstable-book/src/compiler-flags/check-cfg.md) | 8 | ||||
| -rw-r--r-- | src/doc/rustc/src/command-line-arguments.md | 10 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/command-line-arguments.md | 14 | ||||
| -rw-r--r-- | src/doc/rustdoc/src/unstable-features.md | 16 |
5 files changed, 26 insertions, 23 deletions
diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index db85753145d..31096b6df92 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -77,6 +77,7 @@ - [Profile-guided Optimization](profile-guided-optimization.md) - [Instrumentation-based Code Coverage](instrument-coverage.md) - [Linker-plugin-based LTO](linker-plugin-lto.md) +- [Checking conditional configurations](check-cfg.md) - [Exploit Mitigations](exploit-mitigations.md) - [Symbol Mangling](symbol-mangling/index.md) - [v0 Symbol Format](symbol-mangling/v0.md) diff --git a/src/doc/unstable-book/src/compiler-flags/check-cfg.md b/src/doc/rustc/src/check-cfg.md index 836929aba0b..37708bda1f3 100644 --- a/src/doc/unstable-book/src/compiler-flags/check-cfg.md +++ b/src/doc/rustc/src/check-cfg.md @@ -1,10 +1,4 @@ -# `check-cfg` - -The tracking issue for this feature is: [#82450](https://github.com/rust-lang/rust/issues/82450). - ------------------------- - -This feature enables checking of conditional configuration. +# Checking conditional configurations `rustc` accepts the `--check-cfg` option, which specifies whether to check conditions and how to check them. The `--check-cfg` option takes a value, called the _check cfg specification_. diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index 5e02453e236..7c605333c25 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -18,6 +18,16 @@ The value can either be a single identifier or two identifiers separated by `=`. For examples, `--cfg 'verbose'` or `--cfg 'feature="serde"'`. These correspond to `#[cfg(verbose)]` and `#[cfg(feature = "serde")]` respectively. +<a id="option-check-cfg"></a> +## `--check-cfg`: enables checking conditional configurations + +This flag will enable checking conditional configurations. +Refer to the [Checking conditional configurations](check-cfg.md) of this book +for further details and explanation. + +For examples, `--check-cfg 'cfg(verbose)'` or `--check-cfg 'cfg(feature, values("serde"))'`. +These correspond to `#[cfg(verbose)]` and `#[cfg(feature = "serde")]` respectively. + <a id="option-l-search-path"></a> ## `-L`: add a directory to the library search path diff --git a/src/doc/rustdoc/src/command-line-arguments.md b/src/doc/rustdoc/src/command-line-arguments.md index fe5cb529c26..822f341b370 100644 --- a/src/doc/rustdoc/src/command-line-arguments.md +++ b/src/doc/rustdoc/src/command-line-arguments.md @@ -131,6 +131,20 @@ This flag accepts the same values as `rustc --cfg`, and uses it to configure compilation. The example above uses `feature`, but any of the `cfg` values are acceptable. +## `--check-cfg`: check configuration flags + +This flag accepts the same values as `rustc --check-cfg`, and uses it to +check configuration flags. + +Using this flag looks like this: + +```bash +$ rustdoc src/lib.rs --check-cfg='cfg(my_cfg, values("foo", "bar"))' +``` + +The example above check every well known names and values (`target_os`, `doc`, `test`, ...) +and check the values of `my_cfg`: `foo` and `bar`. + ## `--extern`: specify a dependency's location Using this flag looks like this: diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index 41602dec44c..bdb55de8d63 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -618,22 +618,6 @@ crate being documented (`foobar`) and a path to output the calls To scrape examples from test code, e.g. functions marked `#[test]`, then add the `--scrape-tests` flag. -### `--check-cfg`: check configuration flags - - * Tracking issue: [#82450](https://github.com/rust-lang/rust/issues/82450) - -This flag accepts the same values as `rustc --check-cfg`, and uses it to check configuration flags. - -Using this flag looks like this: - -```bash -$ rustdoc src/lib.rs -Z unstable-options \ - --check-cfg='cfg(feature, values("foo", "bar"))' -``` - -The example above check every well known names and values (`target_os`, `doc`, `test`, ...) -and check the values of `feature`: `foo` and `bar`. - ### `--generate-link-to-definition`: Generate links on types in source code * Tracking issue: [#89095](https://github.com/rust-lang/rust/issues/89095) |
