Skip to content

feat: support completions inside cfg!() - #23384

Merged
ChayimFriedman2 merged 4 commits into
rust-lang:masterfrom
A4-Tacks:comp-cfg-macro
Sep 20, 2026
Merged

ChayimFriedman2 merged 4 commits into
rust-lang:masterfrom
A4-Tacks:comp-cfg-macro

Conversation

@A4-Tacks

@A4-Tacks A4-Tacks commented Sep 17, 2026

Copy link
Copy Markdown
Member

Example

fn main() {
    if cfg!($0)
}

Before this PR

Complete list is empty

After this PR

ba all
ba any
ba not
ba true
...

Known Problems

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 17, 2026
@rustbot

This comment has been minimized.

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

The new implementation of the macro feels very wrong and I object to it. What I support instead is expanding to a builtin # cfg expression that also takes CfgPredicate (this cannot support cfg_select! either).

@A4-Tacks

Copy link
Copy Markdown
Member Author

What I support instead is expanding to a builtin # cfg

There is a feature: Expand cfg!() to evaluate the results

If expanded as built-in expr, how to output the result and predicate, like builtin # cfg(true, test)?

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

We will not. This is not better than your approach, and I can tolerate that.

Example
---
```rust
fn main() {
    if cfg!($0)
}
```

**Before this PR**

Complete list is empty

**After this PR**

```text
ba all
ba any
ba not
ba true
...
```
@rustbot

rustbot commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@ChayimFriedman2
ChayimFriedman2 added this pull request to the merge queue Sep 20, 2026
Merged via the queue into rust-lang:master with commit aaddfb7 Sep 20, 2026
20 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 20, 2026
@rustbot rustbot mentioned this pull request Sep 20, 2026
@lnicola

lnicola commented Sep 21, 2026

Copy link
Copy Markdown
Member
image

@A4-Tacks

Copy link
Copy Markdown
Member Author

[image]

Looks like the behavior is in line with expectations

@lnicola

lnicola commented Sep 21, 2026

Copy link
Copy Markdown
Member

Yeah, don't worry, it's image storage for the changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants