forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Regression test for issue #61033. | ||
|
||
macro_rules! test1 { | ||
($x:ident, $($tt:tt)*) => { $($tt)+ } //~ERROR this must repeat at least once | ||
} | ||
|
||
fn main() { | ||
test1!(x,); | ||
} |
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: this must repeat at least once | ||
--> $DIR/issue-61033-1.rs:4:34 | ||
| | ||
LL | ($x:ident, $($tt:tt)*) => { $($tt)+ } | ||
| ^^^^^ | ||
|
||
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,19 @@ | ||
// Regression test for issue #61033. | ||
|
||
macro_rules! test2 { | ||
( | ||
$(* $id1:ident)* | ||
$(+ $id2:ident)* | ||
) => { | ||
$( //~ERROR meta-variable `id1` repeats 2 times | ||
$id1 + $id2 // $id1 and $id2 may repeat different numbers of times | ||
)* | ||
} | ||
} | ||
|
||
fn main() { | ||
test2! { | ||
* a * b | ||
+ a + b + c | ||
} | ||
} |
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,11 @@ | ||
error: meta-variable `id1` repeats 2 times, but `id2` repeats 3 times | ||
--> $DIR/issue-61033-2.rs:8:10 | ||
| | ||
LL | $( | ||
| __________^ | ||
LL | | $id1 + $id2 // $id1 and $id2 may repeat different numbers of times | ||
LL | | )* | ||
| |_________^ | ||
|
||
error: aborting due to previous error | ||
|