Skip to content

Commit 2d1762d

Browse files
committed
Add documentation for -Zcheck-target-cfgs
1 parent bd376fb commit 2d1762d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/doc/src/reference/unstable.md

+24
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ Each new feature described below should explain how to use it.
118118
* [lockfile-path](#lockfile-path) --- Allows to specify a path to lockfile other than the default path `<workspace_root>/Cargo.lock`.
119119
* [package-workspace](#package-workspace) --- Allows for packaging and publishing multiple crates in a workspace.
120120
* [native-completions](#native-completions) --- Move cargo shell completions to native completions.
121+
* [check-target-cfgs](#check-target-cfgs) --- Allows checking unexpected cfgs in `[target.'cfg(...)']`
121122

122123
## allow-features
123124

@@ -1728,6 +1729,29 @@ When in doubt, you can discuss this in [#14520](https://github.com/rust-lang/car
17281729
- powershell:
17291730
Add `CARGO_COMPLETE=powershell cargo +nightly | Invoke-Expression` to `$PROFILE`.
17301731

1732+
## check-target-cfgs
1733+
1734+
* Tracking Issue: [#00000](https://github.com/rust-lang/cargo/issues/00000)
1735+
1736+
This feature checks for unexpected cfgs in `[target.'cfg(...)']` entries, based
1737+
on `rustc --print=check-cfg`. It does **not** follow `RUSTFLAGS` but instead use
1738+
the lint configuration.
1739+
1740+
```sh
1741+
cargo check -Zcheck-target-cfgs
1742+
```
1743+
1744+
It follows the lint Rust `unexpected_cfgs` lint configuration:
1745+
1746+
```toml
1747+
[target.'cfg(foo)'.dependencies]
1748+
cfg-if = "1.0"
1749+
1750+
[lints.rust.unexpected_cfgs]
1751+
level = "warn"
1752+
check-cfg = ['cfg(foo)']
1753+
```
1754+
17311755
# Stabilized and removed features
17321756

17331757
## Compile progress

0 commit comments

Comments
 (0)