Repository navigation
improve diagnostic for literals in lint attributes - #164486
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
|
Reminder, once the PR becomes ready for a review, use |
…JonathanBrouwer
improve diagnostic for literals in lint attributes
Improves the diagnostic for literals in lint attributes, like `#[allow("meow")]`.
Before:
```
error[E0452]: malformed lint attribute input
--> main.rs:5:9
|
5 | #[allow("meow")]
| ^^^^^^ bad attribute argument
error[E0452]: malformed lint attribute input
--> main.rs:8:8
|
8 | #[deny(1.0)]
| ^^^ bad attribute argument
```
After:
```
error: expected path to a lint, found literal
--> main.rs:5:9
|
5 | #[allow("meow")]
| ^^^^^^ not a lint
|
= help: try using `#[allow(meow)]`
error: expected path to a lint, found literal
--> main.rs:8:8
|
8 | #[deny(1.0)]
| ^^^ not a lint
|
= help: for example, write `#[deny(dead_code)]` for `dead_code`
```
Probably easier to review with whitespace changes turned off.
r? JonathanBrouwer
|
This pull request was unapproved due to being closed. This PR was contained in the following rollups:
|
|
Whoops I did not intend on doing that |
|
@bors r+ force |
…uwer Rollup of 6 pull requests Successful merges: - #164518 (stdarch subtree update) - #164497 (Generate redirect pages for hidden modules) - #113891 (Add more syscall doc aliases to std docs) - #163692 (breakpoint: warn against relying on SIGTRAP aborts) - #164486 (improve diagnostic for literals in lint attributes) - #164511 (abort_on_unwind: clarify docs)
Rollup merge of #164486 - annieversary:bad-attribute-lit, r=JonathanBrouwer improve diagnostic for literals in lint attributes Improves the diagnostic for literals in lint attributes, like `#[allow("meow")]`. Before: ``` error[E0452]: malformed lint attribute input --> main.rs:5:9 | 5 | #[allow("meow")] | ^^^^^^ bad attribute argument error[E0452]: malformed lint attribute input --> main.rs:8:8 | 8 | #[deny(1.0)] | ^^^ bad attribute argument ``` After: ``` error: expected path to a lint, found literal --> main.rs:5:9 | 5 | #[allow("meow")] | ^^^^^^ not a lint | = help: try using `#[allow(meow)]` error: expected path to a lint, found literal --> main.rs:8:8 | 8 | #[deny(1.0)] | ^^^ not a lint | = help: for example, write `#[deny(dead_code)]` for `dead_code` ``` Probably easier to review with whitespace changes turned off. r? JonathanBrouwer
…uwer Rollup of 6 pull requests Successful merges: - rust-lang/rust#164518 (stdarch subtree update) - rust-lang/rust#164497 (Generate redirect pages for hidden modules) - rust-lang/rust#113891 (Add more syscall doc aliases to std docs) - rust-lang/rust#163692 (breakpoint: warn against relying on SIGTRAP aborts) - rust-lang/rust#164486 (improve diagnostic for literals in lint attributes) - rust-lang/rust#164511 (abort_on_unwind: clarify docs)
View all comments
Improves the diagnostic for literals in lint attributes, like
#[allow("meow")].Before:
After:
Probably easier to review with whitespace changes turned off.
r? JonathanBrouwer