2021-01-28 14:47:59 +00:00
|
|
|
//@ force-host
|
|
|
|
//@ no-prefer-dynamic
|
|
|
|
|
|
|
|
#![crate_type = "proc-macro"]
|
|
|
|
#![feature(proc_macro_quote)]
|
|
|
|
|
|
|
|
extern crate proc_macro;
|
|
|
|
use proc_macro::{TokenStream, quote};
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn first_attr(_: TokenStream, input: TokenStream) -> TokenStream {
|
|
|
|
let recollected: TokenStream = input.into_iter().collect();
|
2021-04-08 21:01:15 +00:00
|
|
|
println!("First recollected: {:#?}", recollected);
|
2021-01-28 14:47:59 +00:00
|
|
|
quote! {
|
|
|
|
#[second_attr]
|
|
|
|
$recollected
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn second_attr(_: TokenStream, input: TokenStream) -> TokenStream {
|
2021-04-08 21:01:15 +00:00
|
|
|
let recollected: TokenStream = input.into_iter().collect();
|
|
|
|
println!("Second recollected: {:#?}", recollected);
|
2021-01-28 14:47:59 +00:00
|
|
|
TokenStream::new()
|
|
|
|
}
|