forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for macro_rules! invoking a proc-macro with capture groups
- Loading branch information
Showing
2 changed files
with
30 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,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() {} |
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,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`. |