Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Oct 6, 2024

What does this PR try to resolve?

This PR implements rust-lang/rfcs#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.

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) and cfg(false), I choose to gate the feature under a error and not a warning.

  • Create and link the tracking issue for the Cargo side

@rustbot
Copy link
Collaborator

rustbot commented Oct 6, 2024

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-cfg-expr Area: Platform cfg expressions A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-unstable Area: nightly unstable support S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 6, 2024
@epage
Copy link
Contributor

epage commented Oct 8, 2024

@bors
Copy link
Contributor

bors commented Oct 8, 2024

☔ The latest upstream changes (presumably #14137) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Oct 31, 2024

☔ The latest upstream changes (presumably #14752) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Nov 6, 2024

☔ The latest upstream changes (presumably #14497) made this pull request unmergeable. Please resolve the merge conflicts.

@bors
Copy link
Contributor

bors commented Nov 15, 2024

☔ The latest upstream changes (presumably ed31dad) made this pull request unmergeable. Please resolve the merge conflicts.

github-merge-queue bot pushed a commit that referenced this pull request Nov 26, 2024
…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
@bors
Copy link
Contributor

bors commented Nov 26, 2024

☔ The latest upstream changes (presumably 10c255a) made this pull request unmergeable. Please resolve the merge conflicts.

@Urgau
Copy link
Member Author

Urgau commented Dec 1, 2024

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

@rustbot rustbot added S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 1, 2024
@rustbot

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. label Dec 20, 2024
@weihanglo
Copy link
Member

Therefore this PR is blocked on enough time having passed to being able to unconditional apply to new logic.

@Urgau
Copy link
Member Author

Urgau commented Dec 24, 2024

  • Do we have any discussion of “enough time” elsewhere like on Zulip?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cfg-expr Area: Platform cfg expressions A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-unstable Area: nightly unstable support S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants