-
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.
Rollup merge of #137622 - jdonszelmann:fix-137589, r=compiler-errors
fix attribute-related ICE when parsing macro on the rhs of a name-value attribute r? ``@oli-obk`` Closes: #137589
- Loading branch information
Showing
8 changed files
with
87 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Tests for the issue in #137589 | ||
#[crate_type = foo!()] | ||
//~^ ERROR cannot find macro `foo` in this scope | ||
|
||
macro_rules! foo {} //~ ERROR unexpected end of macro invocation | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error: unexpected end of macro invocation | ||
--> $DIR/crate-type-macro-empty.rs:5:1 | ||
| | ||
LL | macro_rules! foo {} | ||
| ^^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments | ||
|
||
error: cannot find macro `foo` in this scope | ||
--> $DIR/crate-type-macro-empty.rs:2:16 | ||
| | ||
LL | #[crate_type = foo!()] | ||
| ^^^ consider moving the definition of `foo` before this call | ||
| | ||
note: a macro with the same name exists, but it appears later | ||
--> $DIR/crate-type-macro-empty.rs:5:14 | ||
| | ||
LL | macro_rules! foo {} | ||
| ^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
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,9 @@ | ||
// Tests for the issue in #137589 | ||
|
||
|
||
macro_rules! foo { | ||
($x:expr) => {"rlib"} | ||
} | ||
|
||
#[crate_type = foo!()] //~ ERROR unexpected end of macro invocation | ||
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
error: unexpected end of macro invocation | ||
--> $DIR/crate-type-macro-not-crate.rs:8:16 | ||
| | ||
LL | macro_rules! foo { | ||
| ---------------- when calling this macro | ||
... | ||
LL | #[crate_type = foo!()] | ||
| ^^^^^^ missing tokens in macro arguments | ||
| | ||
note: while trying to match meta-variable `$x:expr` | ||
--> $DIR/crate-type-macro-not-crate.rs:5:6 | ||
| | ||
LL | ($x:expr) => {"rlib"} | ||
| ^^^^^^^ | ||
|
||
error: aborting due to 1 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,8 @@ | ||
// Tests for the issue in #137589 | ||
#[crate_type = foo!()] //~ ERROR cannot find macro `foo` in this scope | ||
|
||
macro_rules! foo { | ||
($x:expr) => {"rlib"} | ||
} | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: cannot find macro `foo` in this scope | ||
--> $DIR/crate-type-macro-not-found.rs:2:16 | ||
| | ||
LL | #[crate_type = foo!()] | ||
| ^^^ consider moving the definition of `foo` before this call | ||
| | ||
note: a macro with the same name exists, but it appears later | ||
--> $DIR/crate-type-macro-not-found.rs:4:14 | ||
| | ||
LL | macro_rules! foo { | ||
| ^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|