Add well known values to --check-cfg implementation#94362
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tonames()except thatnames(foo)also activate well known names whilevalues(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