mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00

### What does this PR try to resolve? This PR implements https://github.com/rust-lang/rfcs/pull/3695: allow boolean literals as cfg predicates, i.e. `cfg(true)` and `cfg(false)`. ### How should we test and review this PR? The PR should be reviewed commit by commit and tested by looking at the tests and using `[target.'cfg(<true/false>)']` in `Cargo.toml`/`.cargo/config.toml`. ### Additional information I had to bump `cargo-platform` to `0.3.0` has we are changing `CfgExpr` enum in a semver incompatible change. We currently have (thks to https://github.com/rust-lang/cargo/pull/14671) a forward compatibility warning against `cfg(true/false)` as identifiers instead of keywords. ~~I choose a use a `Cargo.toml` feature (for the manifest) as well as a unstable CLI flag for the `.cargo/config.toml` part.~~ ~~Given the very small (two occurrences on Github Search) for [`cfg(true)`](https://github.com/search?q=lang%3Atoml+%2F%28%3F-i%29%5C%5Btarget%5C.%5B%27%22%5Dcfg.*true%2F&type=code) and [`cfg(false)`](https://github.com/search?q=lang%3Atoml+%2F%28%3F-i%29%5C%5Btarget%5C.%5B%27%22%5Dcfg.*false%2F&type=code), I choose to gate the feature under a error and not a warning.~~