Repository navigation
improve diagnostic for literals in lint attributes - #164486
annieversary wants to merge 5 commits into
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
|
|
Thanks for the pull request, and welcome! The Rust Project has assigned @JonathanBrouwer (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. |
|
Also grats on your first contrib ^.^ |
This comment has been minimized.
This comment has been minimized.
1697d6c to
1cb7727
Compare
|
I added a test (as a commit before the one with my change, as suggested by @N1ark), changed the original commit to update this test and another that failed, and made another commit to rename sub to kind. :3 |
This comment has been minimized.
This comment has been minimized.
c733425 to
1c9a4b7
Compare
| } | ||
|
|
||
| #[derive(Diagnostic)] | ||
| #[diag("expected path to a lint, found literal")] |
There was a problem hiding this comment.
"expected a lint, found literal"
There was a problem hiding this comment.
lint names are indeed paths, but I think emphasizing this is not needed
| pub(crate) enum BadAttributeLitHelp { | ||
| #[help("try using `#[{$kind}({$sym})]`")] | ||
| StrLit { sym: Symbol, kind: Symbol }, | ||
| #[help("for example, write `#[{$kind}(dead_code)]` for `dead_code`")] |
There was a problem hiding this comment.
Could you also add a case that covers this variant to tests/ui/lint/lint-attribute-literals.rs?
|
Reminder, once the PR becomes ready for a review, use |
Improves the diagnostic for literals in lint attributes, like
#[allow("meow")].Before:
After:
Probably easier to review with whitespace changes turned off.
r? JonathanBrouwer