Closed
Description
my-macro/src/lib.rs
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_derive(Useless)]
pub fn demo(_input: TokenStream) -> TokenStream {
let rules = r#"
macro_rules! id {
($($tt:tt)*) => { $($tt)* };
}
"#;
rules.parse().unwrap()
}
testing/src/main.rs
#[macro_use]
extern crate my_macro;
#[derive(Useless)]
struct _S;
pub fn main() {
println!("{}", id!(true));
}
rustup run nightly-2017-02-13 cargo run
true
rustup run nightly-2017-02-16 cargo run
error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
--> src/main.rs:4:10
|
4 | #[derive(Useless)]
| ^^^^^^^
error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
--> src/main.rs:4:10
|
4 | #[derive(Useless)]
| ^^^^^^^
error: aborting due to 2 previous errors
cc @jseyfried who touched macro expansion recently