-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parse error message for meta items
- Loading branch information
Showing
13 changed files
with
93 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
macro_rules! mac { | ||
($attr_item: meta) => { | ||
#[cfg($attr_item)] | ||
//~^ ERROR expected unsuffixed literal or identifier, found `an(arbitrary token stream)` | ||
//~| ERROR expected unsuffixed literal or identifier, found `an(arbitrary token stream)` | ||
//~^ ERROR expected unsuffixed literal, found `an(arbitrary token stream)` | ||
//~| ERROR expected unsuffixed literal, found `an(arbitrary token stream)` | ||
struct S; | ||
} | ||
} | ||
|
||
mac!(an(arbitrary token stream)); | ||
|
||
#[cfg(feature = -1)] | ||
//~^ ERROR expected unsuffixed literal, found `-` | ||
//~| ERROR expected unsuffixed literal, found `-` | ||
fn handler() {} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
//@ compile-flags: -Zdeduplicate-diagnostics=yes | ||
//@ run-rustfix | ||
|
||
#![allow(unexpected_cfgs)] | ||
|
||
fn main() { | ||
#[cfg(key=foo)] | ||
//~^ ERROR expected unsuffixed literal, found `foo` | ||
//~| HELP surround the identifier with quotation marks to parse it as a string | ||
//~| HELP surround the identifier with quotation marks to make it into a string | ||
println!(); | ||
#[cfg(key="bar")] | ||
println!(); | ||
#[cfg(key=foo bar baz)] | ||
//~^ ERROR expected unsuffixed literal, found `foo` | ||
//~| HELP surround the identifier with quotation marks to parse it as a string | ||
//~| HELP surround the identifier with quotation marks to make it into a string | ||
println!(); | ||
} | ||
|
||
// Don't suggest surrounding `$name` or `nickname` with quotes: | ||
|
||
macro_rules! make { | ||
($name:ident) => { #[doc(alias = $name)] pub struct S; } | ||
//~^ ERROR expected unsuffixed literal, found `nickname` | ||
} | ||
|
||
make!(nickname); //~ NOTE in this expansion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
error: expected unsuffixed literal, found `foo` | ||
--> $DIR/attr-unquoted-ident.rs:7:15 | ||
--> $DIR/attr-unquoted-ident.rs:6:15 | ||
| | ||
LL | #[cfg(key=foo)] | ||
| ^^^ | ||
| | ||
help: surround the identifier with quotation marks to parse it as a string | ||
help: surround the identifier with quotation marks to make it into a string | ||
| | ||
LL | #[cfg(key="foo")] | ||
| + + | ||
|
||
error: expected unsuffixed literal, found `foo` | ||
--> $DIR/attr-unquoted-ident.rs:13:15 | ||
--> $DIR/attr-unquoted-ident.rs:12:15 | ||
| | ||
LL | #[cfg(key=foo bar baz)] | ||
| ^^^ | ||
| | ||
help: surround the identifier with quotation marks to parse it as a string | ||
help: surround the identifier with quotation marks to make it into a string | ||
| | ||
LL | #[cfg(key="foo bar baz")] | ||
| + + | ||
|
||
error: aborting due to 2 previous errors | ||
error: expected unsuffixed literal, found `nickname` | ||
--> $DIR/attr-unquoted-ident.rs:21:38 | ||
| | ||
LL | ($name:ident) => { #[doc(alias = $name)] pub struct S; } | ||
| ^^^^^ | ||
... | ||
LL | make!(nickname); | ||
| --------------- in this macro invocation | ||
| | ||
= note: this error originates in the macro `make` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 3 previous errors | ||
|