forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#59079 - euclio:macro-semi, r=estebank
add suggestions to invalid macro item error r? @estebank
- Loading branch information
Showing
5 changed files
with
85 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
macro_rules! foo() //~ ERROR semicolon | ||
//~| ERROR unexpected end of macro | ||
|
||
macro_rules! bar { | ||
($($tokens:tt)*) => {} | ||
} | ||
|
||
bar!( //~ ERROR semicolon | ||
blah | ||
blah | ||
blah | ||
) | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,45 @@ | ||
error: macros that expand to items must either be surrounded with braces or followed by a semicolon | ||
error: macros that expand to items must be delimited with braces or followed by a semicolon | ||
--> $DIR/macros-no-semicolon-items.rs:1:17 | ||
| | ||
LL | macro_rules! foo() //~ ERROR semicolon | ||
| ^^ | ||
help: change the delimiters to curly braces | ||
| | ||
LL | macro_rules! foo {} //~ ERROR semicolon | ||
| ^^ | ||
help: add a semicolon | ||
| | ||
LL | macro_rules! foo(); //~ ERROR semicolon | ||
| ^ | ||
|
||
error: macros that expand to items must be delimited with braces or followed by a semicolon | ||
--> $DIR/macros-no-semicolon-items.rs:8:5 | ||
| | ||
LL | bar!( //~ ERROR semicolon | ||
| _____^ | ||
LL | | blah | ||
LL | | blah | ||
LL | | blah | ||
LL | | ) | ||
| |_^ | ||
help: change the delimiters to curly braces | ||
| | ||
LL | bar! { //~ ERROR semicolon | ||
LL | blah | ||
LL | blah | ||
LL | blah | ||
LL | } | ||
| | ||
help: add a semicolon | ||
| | ||
LL | ); | ||
| ^ | ||
|
||
error: unexpected end of macro invocation | ||
--> $DIR/macros-no-semicolon-items.rs:1:1 | ||
| | ||
LL | macro_rules! foo() //~ ERROR semicolon | ||
| ^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 3 previous errors | ||
|