Skip to content

Commit

Permalink
Add test for macro_rules! invoking a proc-macro with capture groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed May 22, 2020
1 parent 2af0218 commit 30c00fd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/ui/proc-macro/macro-rules-capture.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// aux-build: test-macros.rs

extern crate test_macros;
use test_macros::recollect_attr;

macro_rules! reemit {
($name:ident => $($token:expr)*) => {

#[recollect_attr]
pub fn $name() {
$($token)*;
}
}
}

reemit! { foo => 45u32.into() } //~ ERROR type annotations

fn main() {}
12 changes: 12 additions & 0 deletions src/test/ui/proc-macro/macro-rules-capture.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error[E0282]: type annotations needed
--> $DIR/macro-rules-capture.rs:16:24
|
LL | reemit! { foo => 45u32.into() }
| ------^^^^--
| | |
| | cannot infer type for type parameter `T` declared on the trait `Into`
| this method call resolves to `T`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0282`.

0 comments on commit 30c00fd

Please sign in to comment.