Skip to content

Commit b02d576

Browse files
Apply second round of suggestions from code review
Co-authored-by: Jacob Lifshay <programmerjake@gmail.com>
1 parent 3fdb571 commit b02d576

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ team: The Cargo Team <https://www.rust-lang.org/governance/teams/dev-tools#cargo
77

88
# Automatic checking of cfgs at compile-time
99

10-
The Cargo and Compiler team are delighted to announce that starting with Rust 1.80 (or nightly-2024-04-XX) every _reachable_ `#[cfg]`s will be automatically checked for expected config names and values.
10+
The Cargo and Compiler team are delighted to announce that starting with Rust 1.80 (or nightly-2024-04-XX) every _reachable_ `#[cfg]` will be automatically checked that they match the expected config names and values.
1111

1212
This can help with verifying that the crate is correctly handling conditional compilation for different target platforms or features. It ensures that the cfg settings are consistent between what is intended and what is used, helping to catch potential bugs or errors early in the development process.
1313

@@ -56,7 +56,7 @@ fn win() {}
5656
5757
Some crates use custom cfgs that they either expected from the environment (`RUSTFLAGS`or other means) or is enabled by some logic in the crate `build.rs`. For those crates Cargo provides a new instruction: [`cargo::rustc-check-cfg`](TODO)[^2] (or `cargo:rustc-check-cfg` for older Cargo version).
5858

59-
[^2]: `cargo::rustc-check-cfg` take action since Rust 1.80, between Rust 1.77 and Rust 1.79 *(included)* it silently did nothing and before that (so Rust 1.76 and below) it warned when used without the unstable Cargo `-Zcheck-cfg`.
59+
[^2]: `cargo::rustc-check-cfg` will start working in Rust 1.80 (or nightly-2024-04-XX), between Rust 1.77 and Rust 1.79 *(included)* it silently did nothing and before that (so Rust 1.76 and below) it warned when used without the unstable Cargo `-Zcheck-cfg`.
6060

6161
The syntax to use is described in the [rustc book](https://doc.rust-lang.org/rustc/index.html) section [checking configuration](TODO), but in a nutshell the basic syntax of `--check-cfg` is:
6262

@@ -95,7 +95,7 @@ More details can be found on the [`rustc` book](TODO).
9595

9696
### Can it be disabled?
9797

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

100100
### How does it interact with the `RUSTFLAGS` env ?
101101

0 commit comments

Comments
 (0)