Skip to content

Commit 90c2b74

Browse files
Apply review suggestions.
This reverts some of the changes since they were done intentionally, and tries to improve the clarity in other areas.
1 parent a2667a2 commit 90c2b74

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/conditional-compilation.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@
2727
Each form of conditional compilation takes a _configuration predicate_ that
2828
evaluates to true or false. The predicate is one of the following:
2929

30-
* A configuration option. The predicate is true if the option is set, and false if it is
31-
unset.
32-
* `all()` with a comma-separated list of configuration predicates. It is true precisely if all of the given predicates are true.
33-
* `any()` with a comma-separated list of configuration predicates. It is true precisely if at least one of the given predicates is true.
34-
* `not()` with a configuration predicate. It is true precisely if the given predicate is false.
30+
* A configuration option. The predicate is true if the option is set, and false if it is unset.
31+
* `all()` with a comma-separated list of configuration predicates. It is true if all of the given predicates are true, or if the list is empty.
32+
* `any()` with a comma-separated list of configuration predicates. It is true if at least one of the given predicates is true. If there are no predicates, it is false.
33+
* `not()` with a configuration predicate. It is true if its predicate is false and false if its predicate is true.
3534

36-
_Configuration options_ are either names or key-value pairs, and are either set or
37-
unset. Configuration options that are names, such as `unix`, are specified by simply writing them.
38-
Configuration options that are key-value pairs are written in the form `key = "value"`, such as `target_arch = "x86_64"`.
35+
_Configuration options_ are either names or key-value pairs, and are either set or unset.
36+
Names are written as a single identifier, such as `unix`.
37+
Key-value pairs are written as an identifier, `=`, and then a string, such as `target_arch = "x86_64"`.
3938

4039
> **Note**: Whitespace around the `=` is ignored, so `foo="bar"` and `foo = "bar"` are equivalent.
4140
@@ -46,7 +45,7 @@ Keys do not need to be unique. For example, both `feature = "std"` and `feature
4645
Which configuration options are set is determined statically during the
4746
compilation of the crate. Some options are _compiler-set_ based on data
4847
about the compilation. Other options are _arbitrarily-set_ based on input
49-
passed to the compiler outside of the code. It is impossible to set a
48+
passed to the compiler outside of the code. It is not possible to set a
5049
configuration option from within the source code of the crate being compiled.
5150

5251
> **Note**: For `rustc`, arbitrary-set configuration options are set using the
@@ -250,7 +249,9 @@ Example values:
250249
<!-- should we say they're active attributes here? -->
251250

252251
The `cfg` [attribute] conditionally includes the thing it is attached to based
253-
on the given configuration predicate (_ConfigurationPredicate_ in the syntax above).
252+
on a configuration predicate.
253+
254+
It is written as `cfg`, `(`, a configuration predicate, and finally `)`.
254255

255256
If the predicate is true, the thing is rewritten to not have the `cfg` attribute
256257
on it. If the predicate is false, the thing is removed from the source code.

0 commit comments

Comments
 (0)