-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify invalid macro in expression context diagnostic
- Loading branch information
Showing
7 changed files
with
91 additions
and
34 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// run-rustfix | ||
|
||
macro_rules! foo { | ||
() => { | ||
assert_eq!("A", "A"); | ||
assert_eq!("B", "B"); | ||
} | ||
//~^^ ERROR macro expansion ignores token `assert_eq` and any following | ||
//~| NOTE the usage of `foo!` is likely invalid in expression context | ||
} | ||
|
||
fn main() { | ||
foo!(); | ||
//~^ NOTE caused by the macro expansion here | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// run-rustfix | ||
|
||
macro_rules! foo { | ||
() => { | ||
assert_eq!("A", "A"); | ||
assert_eq!("B", "B"); | ||
} | ||
//~^^ ERROR macro expansion ignores token `assert_eq` and any following | ||
//~| NOTE the usage of `foo!` is likely invalid in expression context | ||
} | ||
|
||
fn main() { | ||
foo!() | ||
//~^ NOTE caused by the macro expansion here | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error: macro expansion ignores token `assert_eq` and any following | ||
--> $DIR/macro-in-expression-context.rs:6:9 | ||
| | ||
LL | assert_eq!("B", "B"); | ||
| ^^^^^^^^^ | ||
... | ||
LL | foo!() | ||
| ------- help: you might be missing a semicolon here: `;` | ||
| | | ||
| caused by the macro expansion here | ||
| | ||
= note: the usage of `foo!` is likely invalid in expression context | ||
|
||
error: aborting due to previous error | ||
|
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