Skip to content

Commit 4cf54e4

Browse files
authored
Rollup merge of rust-lang#95166 - Urgau:check-cfg-values-unstable-book, r=petrochenkov
Update the unstable book with the new `values()` form of check-cfg Forgot to update the unstable book in rust-lang#94362 r? `@petrochenkov`
2 parents 7e3442a + c6c14a0 commit 4cf54e4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ and `cfg!(name = "value")` call. It will check that the `"value"` specified is p
9292
list of expected values. If `"value"` is not in it, then `rustc` will report an `unexpected_cfgs`
9393
lint diagnostic. The default diagnostic level for this lint is `Warn`.
9494
95-
The form `values()` is an error, because it does not specify a condition name.
96-
9795
To enable checking of values, but to provide an empty set of valid values, use this form:
9896
9997
```bash
@@ -104,13 +102,17 @@ The `--check-cfg values(...)` option can be repeated, both for the same conditio
104102
different names. If it is repeated for the same condition name, then the sets of values for that
105103
condition are merged together.
106104
105+
If `values()` is specified, then `rustc` will enable the checking of well-known values defined
106+
by itself. Note that it's necessary to specify the `values()` form to enable the checking of
107+
well known values, specifying the other forms doesn't implicitly enable it.
108+
107109
## Examples
108110
109111
Consider this command line:
110112
111113
```bash
112114
rustc --check-cfg 'names(feature)' \
113-
--check-cfg 'values(feature,"lion","zebra")' \
115+
--check-cfg 'values(feature, "lion", "zebra")' \
114116
--cfg 'feature="lion"' -Z unstable-options \
115117
example.rs
116118
```

0 commit comments

Comments
 (0)