about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2024-09-30 11:15:05 +0200
committerUrgau <urgau@numericable.fr>2024-09-30 11:15:05 +0200
commit020bd6d323f20fa3c723320ee5b8484a8bcaa6cb (patch)
tree9691199352f5206a9148c3910c0a7dcecf6ae294
parent2da3cb9cab706ff029ee5a40c6dee1c1f188e0bb (diff)
downloadrust-020bd6d323f20fa3c723320ee5b8484a8bcaa6cb.tar.gz
rust-020bd6d323f20fa3c723320ee5b8484a8bcaa6cb.zip
Improve `--print=check-cfg` documentation
-rw-r--r--src/doc/unstable-book/src/compiler-flags/print-check-cfg.md27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/print-check-cfg.md b/src/doc/unstable-book/src/compiler-flags/print-check-cfg.md
index ab63c986e85..8d314aa62d4 100644
--- a/src/doc/unstable-book/src/compiler-flags/print-check-cfg.md
+++ b/src/doc/unstable-book/src/compiler-flags/print-check-cfg.md
@@ -4,23 +4,28 @@ The tracking issue for this feature is: [#125704](https://github.com/rust-lang/r
 
 ------------------------
 
-This option of the `--print` flag print the list of expected cfgs.
+This option of the `--print` flag print the list of all the expected cfgs.
 
-This is related to the `--check-cfg` flag which allows specifying arbitrary expected
+This is related to the [`--check-cfg` flag][check-cfg] which allows specifying arbitrary expected
 names and values.
 
-This print option works similarly to `--print=cfg` (modulo check-cfg specifics):
- - *check_cfg syntax*: *output of --print=check-cfg*
- - `cfg(windows)`: `windows`
- - `cfg(feature, values("foo", "bar"))`: `feature="foo"` and `feature="bar"`
- - `cfg(feature, values(none(), ""))`: `feature` and `feature=""`
- - `cfg(feature, values(any()))`: `feature=any()`
- - `cfg(feature, values())`: `feature=`
- - `cfg(any())`: `any()`
- - *nothing*: `any()=any()`
+This print option works similarly to `--print=cfg` (modulo check-cfg specifics).
+
+| `--check-cfg`                     | `--print=check-cfg`         |
+|-----------------------------------|-----------------------------|
+| `cfg(foo)`                        | `foo`                       |
+| `cfg(foo, values("bar"))`         | `foo="bar"`                 |
+| `cfg(foo, values(none(), "bar"))` | `foo` & `foo="bar"`         |
+|                                   | *check-cfg specific syntax* |
+| `cfg(foo, values(any())`          | `foo=any()`                 |
+| `cfg(foo, values())`              | `foo=`                      |
+| `cfg(any())`                      | `any()`                     |
+| *none*                            | `any()=any()`               |
 
 To be used like this:
 
 ```bash
 rustc --print=check-cfg -Zunstable-options lib.rs
 ```
+
+[check-cfg]: https://doc.rust-lang.org/nightly/rustc/check-cfg.html