Skip to content

Commit 30c00fd

Browse files
committed
Add test for macro_rules! invoking a proc-macro with capture groups
1 parent 2af0218 commit 30c00fd

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// aux-build: test-macros.rs
2+
3+
extern crate test_macros;
4+
use test_macros::recollect_attr;
5+
6+
macro_rules! reemit {
7+
($name:ident => $($token:expr)*) => {
8+
9+
#[recollect_attr]
10+
pub fn $name() {
11+
$($token)*;
12+
}
13+
}
14+
}
15+
16+
reemit! { foo => 45u32.into() } //~ ERROR type annotations
17+
18+
fn main() {}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/macro-rules-capture.rs:16:24
3+
|
4+
LL | reemit! { foo => 45u32.into() }
5+
| ------^^^^--
6+
| | |
7+
| | cannot infer type for type parameter `T` declared on the trait `Into`
8+
| this method call resolves to `T`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)