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#55292 - estebank:macro-eof, r=pnkfelix
Macro diagnostics tweaks Fix rust-lang#30128, fix rust-lang#10951 by adding an appropriate span to the diagnostic. Fix rust-lang#26288 by suggesting adding semicolon to macro call.
- Loading branch information
Showing
11 changed files
with
123 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
macro_rules! empty { () => () } | ||
|
||
fn main() { | ||
match 42 { | ||
_ => { empty!() } | ||
}; | ||
} |
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,8 @@ | ||
error: expected expression, found `<eof>` | ||
--> $DIR/macro-in-expression-context-2.rs:5:16 | ||
| | ||
LL | _ => { empty!() } | ||
| ^^^^^^^^ | ||
|
||
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
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