Skip to content

Commit 8502e99

Browse files
authored
Rollup merge of rust-lang#131053 - Urgau:print-check-cfg-doc, r=jieyouxu
Improve `--print=check-cfg` documentation This PR improves the `--print=check-cfg` documentation by: 1. switching to a table for better readability 2. adding a clear indication where the specific check-cfg syntax starts 3. adding a link to the main `--check-cfg` documentation `@rustbot` label +F-check-cfg
2 parents 5df1123 + 020bd6d commit 8502e99

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/doc/unstable-book/src/compiler-flags/print-check-cfg.md

+16-11
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,28 @@ The tracking issue for this feature is: [#125704](https://github.com/rust-lang/r
44

55
------------------------
66

7-
This option of the `--print` flag print the list of expected cfgs.
7+
This option of the `--print` flag print the list of all the expected cfgs.
88

9-
This is related to the `--check-cfg` flag which allows specifying arbitrary expected
9+
This is related to the [`--check-cfg` flag][check-cfg] which allows specifying arbitrary expected
1010
names and values.
1111

12-
This print option works similarly to `--print=cfg` (modulo check-cfg specifics):
13-
- *check_cfg syntax*: *output of --print=check-cfg*
14-
- `cfg(windows)`: `windows`
15-
- `cfg(feature, values("foo", "bar"))`: `feature="foo"` and `feature="bar"`
16-
- `cfg(feature, values(none(), ""))`: `feature` and `feature=""`
17-
- `cfg(feature, values(any()))`: `feature=any()`
18-
- `cfg(feature, values())`: `feature=`
19-
- `cfg(any())`: `any()`
20-
- *nothing*: `any()=any()`
12+
This print option works similarly to `--print=cfg` (modulo check-cfg specifics).
13+
14+
| `--check-cfg` | `--print=check-cfg` |
15+
|-----------------------------------|-----------------------------|
16+
| `cfg(foo)` | `foo` |
17+
| `cfg(foo, values("bar"))` | `foo="bar"` |
18+
| `cfg(foo, values(none(), "bar"))` | `foo` & `foo="bar"` |
19+
| | *check-cfg specific syntax* |
20+
| `cfg(foo, values(any())` | `foo=any()` |
21+
| `cfg(foo, values())` | `foo=` |
22+
| `cfg(any())` | `any()` |
23+
| *none* | `any()=any()` |
2124

2225
To be used like this:
2326

2427
```bash
2528
rustc --print=check-cfg -Zunstable-options lib.rs
2629
```
30+
31+
[check-cfg]: https://doc.rust-lang.org/nightly/rustc/check-cfg.html

0 commit comments

Comments
 (0)