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

feat: Support cfg(true) and cfg(false) #18420

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

ChayimFriedman2
Copy link
Contributor

As per RFC 3695.

Closes #18397.

I chose to just insert true into the atom list (and prevent touching true and false, for extra safety) as this seems simpler and saves a check when checking cfg (which is more common than updating it). Memory usage impact also should be negligible (one cfg atom per crate).

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 27, 2024
Copy link
Member

@Veykril Veykril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit odd imo, and also does not work super well with the IDE layer integration and the CrateData::potential_cfg_options field, which should technically list both true and false literals I think, for completions sake at least. Though I guess that can be special cased for completions at least.

Will merge it either way for now as its not a big change.

@Veykril Veykril added this pull request to the merge queue Oct 28, 2024
Merged via the queue into rust-lang:master with commit cf8f950 Oct 28, 2024
9 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the cfg-true-false branch October 28, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow boolean literals as cfg predicates
3 participants