Improve invalid cfg predicate error#157613
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JonathanBrouwer (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
| span: meta.span(), | ||
| predicate: meta.path().to_string(), | ||
| })); | ||
| let possibilities = &[sym::any, sym::all, sym::not, sym::target, sym::version]; |
There was a problem hiding this comment.
Hmmm, "version" is an unstable predicate, could you only mention it if the corresponding feature gate is enabled?
|
Reminder, once the PR becomes ready for a review, use |
|
Other than that it seems good, thanks a lot for the improvement! |
This comment has been minimized.
This comment has been minimized.
a2009b1 to
91ee8a5
Compare
This comment has been minimized.
This comment has been minimized.
|
I added the feature check! It seems one of the tests failed last time, I'm not sure why. @rustbot ready |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@evavh The change looks good, thanks! |
6216e84 to
851ab7a
Compare
|
This PR was rebased onto a different main 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. |
I have improved the error that is emitted when a non-existant cfg attribute is used. I removed the InvalidPredicate diagnostic, which does not provide much information, and used the function
expected_specific_argumentinstead. This provides a nice link to the documentation. I have also blessed and updated the ui tests that broke because of this change.Before:
After:
r? @JonathanBrouwer