Skip to content

Commit 133cd51

Browse files
committed
Address PR feedback on drawbacks
1 parent dbc02dc commit 133cd51

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

text/0000-conditional-compilation-checking.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,25 @@ fn tame_lion() { ... }
516516
updated. However, for those systems that are not updated, there is no penalty or drawback,
517517
since `--check-cfg` is opt-in.
518518
519+
* This lint will not be able to detect invalid `#[cfg]` tests that are within modules that
520+
are not compiled, presumably because an ancestor `mod` is disabled due to a. For example:
521+
522+
File `lib.rs` (root module):
523+
```rust
524+
#[cfg(feature = "this_is_disabled_but_valid")]
525+
mod foo
526+
```
527+
528+
File `foo.rs` (nested module):
529+
```rust
530+
#[cfg(feature = "oooooops_this_feature_is_misspelled_and_invalid")]
531+
mod uh_uh;
532+
```
533+
534+
The invalid `#[cfg]` attribute in `foo.rs` will not be detected, because `foo.rs` was not
535+
read and parsed. This is a minor drawback, and should not prevent users from benefitting
536+
from checking in most common situations.
537+
519538
## Rationale and alternatives
520539
521540
This design enables checking for a class of bugs at compile time, rather than detecting them by

0 commit comments

Comments
 (0)