-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement RFC3695: Allow boolean literals as cfg predicates #14649
base: master
Are you sure you want to change the base?
Conversation
r? @weihanglo rustbot has assigned @weihanglo. Use |
☔ The latest upstream changes (presumably #14137) made this pull request unmergeable. Please resolve the merge conflicts. |
6bc170b
to
756003f
Compare
☔ The latest upstream changes (presumably #14752) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #14497) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably ed31dad) made this pull request unmergeable. Please resolve the merge conflicts. |
a7294ad
to
e358842
Compare
…ts (#14671) ### What does this PR try to resolve? This PR tries to address this thread #14649 (comment) in #14649 regarding `cfg(true)`/`cfg(false)` (and keywords more generally) which are wrongly accepted[^1] as ident. To address this, this PR does two things: 1. it introduce a future-incompatibility warning against those (wrongly) accepted keywords as ident 2. it add parsing for raw-idents (`r#true`) add suggest-it in the warning ### How should we test and review this PR? This PR should be reviewed commit-by-commit. Tests are included in preliminary commits. ### Additional information I added a new struct for representing `Ident`s which is rawness aware. Which implied updating `cargo-platform` to `0.2.0` due to the API changes. r? @epage [^1]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ccfb9c894dbf14e791c8ae7e4798efd0
☔ The latest upstream changes (presumably 10c255a) made this pull request unmergeable. Please resolve the merge conflicts. |
The future incompatibility warning was merged in #14671. I tried adding an unstable Cargo feature but that would I mean either making not insignificant refactor to the parsing or evaluation, or adding a hack to transform back, neither felt justified enough for such a temporary mechanism. Therefore this PR is blocked on enough time having passed to being able to unconditional apply to new logic. @rustbot label -S-waiting-on-review +S-blocked-external |
This comment has been minimized.
This comment has been minimized.
e358842
to
b33f175
Compare
|
Not that I'm aware.
I'm planning on issuing after the holidays a call-for-testing and then directly propose a T-lang stabilization. This could mean only 1 or 2 releases with the future compact warning, not sure if you (T-cargo) would be comfortable with that. We could also wait and stabilize both at the same time, but I don't think that's required. |
What does this PR try to resolve?
This PR implements rust-lang/rfcs#3695: allow boolean literals as cfg predicates, i.e.
cfg(true)
andcfg(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>)']
inCargo.toml
/.cargo/config.toml
.Additional information
I had to bump
cargo-platform
to0.3.0
has we are changingCfgExpr
enum in a semver incompatible change.I choose a use aCargo.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) forcfg(true)
andcfg(false)
, I choose to gate the feature under a error and not a warning.