2021-01-28 08:47:59 -06: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 16:01:15 -05:00
|
|
|
println!("First recollected: {:#?}", recollected);
|
2021-01-28 08:47:59 -06:00
|
|
|
quote! {
|
|
|
|
#[second_attr]
|
|
|
|
$recollected
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[proc_macro_attribute]
|
|
|
|
pub fn second_attr(_: TokenStream, input: TokenStream) -> TokenStream {
|
2021-04-08 16:01:15 -05:00
|
|
|
let recollected: TokenStream = input.into_iter().collect();
|
|
|
|
println!("Second recollected: {:#?}", recollected);
|
2021-01-28 08:47:59 -06:00
|
|
|
TokenStream::new()
|
|
|
|
}
|