Skip to content

Commit 8375ca8

Browse files
committed
Add section for non-Cargo based build systems + fix typos
1 parent d9f2a08 commit 8375ca8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

posts/2024-04-29-check-cfg.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,23 @@ More details can be found on the [`rustc` book](https://doc.rust-lang.org/nightl
9797

9898
The feature is **always on** and _cannot_ be disabled from Cargo, but like any other lints it can be controlled: `#![allow(unexpected_cfgs)]`.
9999

100-
### How does it interact with the `RUSTFLAGS` env ?
100+
### Does the lint affect dependencies?
101+
102+
No, the lint only affects local packages; only those will report the lint.
103+
104+
### How does it interact with the `RUSTFLAGS` env?
101105

102106
You should be able to use the `RUSTFLAGS` environment variable like it was before.
103107
*Currently `--cfg` arguments are not checked, only usage in code are.*
104108

105109
This means that doing `RUSTFLAGS="--cfg tokio_unstable" cargo check` will not report any warnings, unless `tokio_unstable` is used within your local crates, in which case crate author will need to make sure that that custom cfg is expected with `cargo::rustc-check-cfg` in the `build.rs` of that crate.
106110

107-
### How to expect custom cfgs without a `build.rs` ?
111+
### How to expect custom cfgs without a `build.rs`?
108112

109-
There is not **currently no way** to expect a custom cfg other than with `cargo::rustc-check-cfg` in a `build.rs`.
113+
There is **currently no way** to expect a custom cfg other than with `cargo::rustc-check-cfg` in a `build.rs`.
110114

111115
Crate authors that don't want to use a `build.rs` are encouraged to use Cargo features instead.
112-
113-
### Does the lint affect dependencies?
114116

115-
No, the lint only affects local packages; only those will report the lint.
117+
### How does it interact with other build systems?
118+
119+
Non-Cargo based build systems are not affected by the lint by default. Build system authors that wish to have the same functionality should look at the `rustc` documentation for the [`--check-cfg`](https://doc.rust-lang.org/nightly/rustc/check-cfg.html) flag for a detailed explanation of how to achieve the same functionality.

0 commit comments

Comments
 (0)