Skip to content

Commit 174816e

Browse files
committed
Address PR feedback
1 parent 133cd51 commit 174816e

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

text/0000-conditional-compilation-checking.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,12 @@ rustc --check-cfg 'names(has_time_travel)'
433433
rustc --check-cfg 'values(feature, "lighting", "bump_maps")'
434434
435435
# names are not checked, but 'feature' values _and_ 'market' values are checked.
436-
rustc --check-cfg 'values(feature, "lighting", "bump_maps")' --check-cfg 'markets(feature = "europe", "asia")'
436+
rustc --check-cfg 'values(feature, "lighting", "bump_maps")' \
437+
--check-cfg 'values(market, "europe", "asia")'
437438
438439
# names _and_ feature values are checked.
439-
rustc --check-cfg 'names(has_time_travel)' --check-cfg 'values(feature, "lighting", "bump_maps")'
440+
rustc --check-cfg 'names(has_time_travel)' \
441+
--check-cfg 'values(feature, "lighting", "bump_maps")'
440442
```
441443
442444
## Stabilizing
@@ -563,14 +565,22 @@ systematically verify the correct usage of conditional compilation in these lang
563565
564566
## Unresolved questions
565567
566-
During the RFC process, I expect to resolve the question of what the exact rustc command-line
567-
parameters should be, at least enough to enable the feature for nightly builds. We should avoid
568-
bikeshedding on the exact syntax, but should agree on the semantics. We should agree on what is
569-
checked, what is not checked, how checking is enabled, and how it is performed. We should agree on
570-
what information is passed from Cargo to Rustc.
571-
572-
During the implementation and before stabilization, I expect to resolve the question of how many errors this actually detects. How many crates on crates.io actually have invalid `#[cfg]` usage?
573-
How valuable is this feature?
568+
This RFC specifies the exact syntax of this feature in source code and in the
569+
command-line options for `rustc`. However, it does not address how these will be used
570+
by tools, such as Cargo. This is a split between "mechanism" and "policy"; the mechanism
571+
(what goes in `rustc`) is specified in this RFC, but the policies that control this
572+
mechanism are intentionally left out of scope.
573+
574+
We expect the stabilization process for the mechanism (the support in `rustc`) to stabilize
575+
relatively quickly. Separately, over a much longer time frame, we expect the polices that
576+
control those options to stabilize more slowly. For example, it seems uncontroversial for
577+
Cargo to enable checking for `feature = "..."` values immediately; this could be
578+
implemented and stabilized quickly.
579+
580+
However, when (if ever) should Cargo enable checking condition _names_? For crates that
581+
do not have a `build.rs` script, Cargo could enable checking condition names immediately.
582+
But for crates that do have a `build.rs` script, we may need a way for those scripts to
583+
control the behavior of checking condition names.
574584
575585
One possible source of problems may come from build scripts (`build.rs` files) that add `--cfg`
576586
options that Cargo is not aware of. For exaple, if a `Cargo.toml` file did _not_ define a feature

0 commit comments

Comments
 (0)