Rollup merge of #59079 - euclio:macro-semi, r=estebank
add suggestions to invalid macro item error r? @estebank
This commit is contained in:
commit
6fbd55385d
5 changed files with 85 additions and 24 deletions
|
|
@ -12,7 +12,7 @@ pub fn main() {
|
|||
foo!();
|
||||
|
||||
assert!({one! two()});
|
||||
//~^ ERROR macros that expand to items must either be surrounded with braces or followed by a
|
||||
//~^ ERROR macros that expand to items
|
||||
//~| ERROR cannot find macro `one!` in this scope
|
||||
//~| ERROR mismatched types
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
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/issue-10536.rs:14:22
|
||||
|
|
||||
LL | assert!({one! two()});
|
||||
| ^^
|
||||
help: change the delimiters to curly braces
|
||||
|
|
||||
LL | assert!({one! two {}});
|
||||
| ^^
|
||||
help: add a semicolon
|
||||
|
|
||||
LL | assert!({one! two();});
|
||||
| ^
|
||||
|
||||
error: expected `(` or `{`, found `}`
|
||||
--> $DIR/issue-10536.rs:21:22
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
| ^^
|
||||
help: change the delimiters to curly braces
|
||||
|
|
||||
LL | macro_rules! foo {}
|
||||
| ^^
|
||||
help: add a semicolon
|
||||
|
|
||||
LL | macro_rules! foo();
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
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!(
|
||||
| _____^
|
||||
LL | | blah
|
||||
LL | | blah
|
||||
LL | | blah
|
||||
LL | | )
|
||||
| |_^
|
||||
help: change the delimiters to curly braces
|
||||
|
|
||||
LL | bar! {
|
||||
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()
|
||||
| ^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue