From 2d1762daa1c2db0458a9e7ded8dda4a0b52116ff Mon Sep 17 00:00:00 2001 From: Urgau Date: Mon, 23 Sep 2024 14:37:27 +0200 Subject: [PATCH] Add documentation for `-Zcheck-target-cfgs` --- src/doc/src/reference/unstable.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index 0dc370cc7c79..323e2e470e44 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -118,6 +118,7 @@ Each new feature described below should explain how to use it. * [lockfile-path](#lockfile-path) --- Allows to specify a path to lockfile other than the default path `/Cargo.lock`. * [package-workspace](#package-workspace) --- Allows for packaging and publishing multiple crates in a workspace. * [native-completions](#native-completions) --- Move cargo shell completions to native completions. + * [check-target-cfgs](#check-target-cfgs) --- Allows checking unexpected cfgs in `[target.'cfg(...)']` ## allow-features @@ -1728,6 +1729,29 @@ When in doubt, you can discuss this in [#14520](https://github.com/rust-lang/car - powershell: Add `CARGO_COMPLETE=powershell cargo +nightly | Invoke-Expression` to `$PROFILE`. +## check-target-cfgs + +* Tracking Issue: [#00000](https://github.com/rust-lang/cargo/issues/00000) + +This feature checks for unexpected cfgs in `[target.'cfg(...)']` entries, based +on `rustc --print=check-cfg`. It does **not** follow `RUSTFLAGS` but instead use +the lint configuration. + +```sh +cargo check -Zcheck-target-cfgs +``` + +It follows the lint Rust `unexpected_cfgs` lint configuration: + +```toml +[target.'cfg(foo)'.dependencies] +cfg-if = "1.0" + +[lints.rust.unexpected_cfgs] +level = "warn" +check-cfg = ['cfg(foo)'] +``` + # Stabilized and removed features ## Compile progress