Skip to content

Add well known values to --check-cfg implementation#94362

Merged
bors merged 2 commits into
rust-lang:masterfrom
Urgau:check-cfg-values
Mar 5, 2022
Merged

Add well known values to --check-cfg implementation#94362
bors merged 2 commits into
rust-lang:masterfrom
Urgau:check-cfg-values

Conversation

@Urgau
Copy link
Copy Markdown
Member

@Urgau Urgau commented Feb 25, 2022

This pull-request adds well known values for the well known names via --check-cfg=values().

RFC 3013: Checking conditional compilation at compile time doesn't define this at all, but this seems a nice improvement.
The activation is done by a empty values() (new syntax) similar to names() except that names(foo) also activate well known names while values(aa, "aa", "kk") would not.

As stated this use a different activation logic because well known values for the well known names are not always sufficient.
In fact this is problematic for every target_* cfg because of non builtin targets, as the current implementation use those built-ins targets to create the list the well known values.

The implementation is straight forward, first we gather (if necessary) all the values (lazily or not) and then we apply them.

r? @petrochenkov

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

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants