about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-03-21 19:48:34 +0100
committerGitHub <noreply@github.com>2022-03-21 19:48:34 +0100
commitaa9077e0c9954f0795f52e73c6a057cf52c9ccae (patch)
tree0f2f195adfe15176f9034bfd13168cf77624c7a3
parent7154fa519329384a8f99b21278053009933e4e51 (diff)
parentc6c14a040dc33663a3e14f1e8a3d0938c65e7ca6 (diff)
downloadrust-aa9077e0c9954f0795f52e73c6a057cf52c9ccae.tar.gz
rust-aa9077e0c9954f0795f52e73c6a057cf52c9ccae.zip
Rollup merge of #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 https://github.com/rust-lang/rust/pull/94362

r? ``@petrochenkov``
-rw-r--r--src/doc/unstable-book/src/compiler-flags/check-cfg.md8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/doc/unstable-book/src/compiler-flags/check-cfg.md b/src/doc/unstable-book/src/compiler-flags/check-cfg.md
index d7345ad0c33..486b3d4414f 100644
--- a/src/doc/unstable-book/src/compiler-flags/check-cfg.md
+++ b/src/doc/unstable-book/src/compiler-flags/check-cfg.md
@@ -92,8 +92,6 @@ and `cfg!(name = "value")` call. It will check that the `"value"` specified is p
 list of expected values. If `"value"` is not in it, then `rustc` will report an `unexpected_cfgs`
 lint diagnostic. The default diagnostic level for this lint is `Warn`.
 
-The form `values()` is an error, because it does not specify a condition name.
-
 To enable checking of values, but to provide an empty set of valid values, use this form:
 
 ```bash
@@ -104,13 +102,17 @@ The `--check-cfg values(...)` option can be repeated, both for the same conditio
 different names. If it is repeated for the same condition name, then the sets of values for that
 condition are merged together.
 
+If `values()` is specified, then `rustc` will enable the checking of well-known values defined
+by itself. Note that it's necessary to specify the `values()` form to enable the checking of
+well known values, specifying the other forms doesn't implicitly enable it.
+
 ## Examples
 
 Consider this command line:
 
 ```bash
 rustc --check-cfg 'names(feature)' \
-      --check-cfg 'values(feature,"lion","zebra")' \
+      --check-cfg 'values(feature, "lion", "zebra")' \
       --cfg 'feature="lion"' -Z unstable-options \
       example.rs
 ```