diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-05-20 13:16:29 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-05-22 15:07:41 -0400 |
| commit | 30c00fd26a24f349df64a7c0f5c3490e9f624322 (patch) | |
| tree | f9f686d973ac6623a54419ffa0687bc6b7a8a71a | |
| parent | 2af0218bf1ffca0750a352554f20a07b760a30a8 (diff) | |
| download | rust-30c00fd26a24f349df64a7c0f5c3490e9f624322.tar.gz rust-30c00fd26a24f349df64a7c0f5c3490e9f624322.zip | |
Add test for macro_rules! invoking a proc-macro with capture groups
| -rw-r--r-- | src/test/ui/proc-macro/macro-rules-capture.rs | 18 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/macro-rules-capture.stderr | 12 |
2 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/proc-macro/macro-rules-capture.rs b/src/test/ui/proc-macro/macro-rules-capture.rs new file mode 100644 index 00000000000..37436567d70 --- /dev/null +++ b/src/test/ui/proc-macro/macro-rules-capture.rs @@ -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() {} diff --git a/src/test/ui/proc-macro/macro-rules-capture.stderr b/src/test/ui/proc-macro/macro-rules-capture.stderr new file mode 100644 index 00000000000..6d512846ff7 --- /dev/null +++ b/src/test/ui/proc-macro/macro-rules-capture.stderr @@ -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`. |
