rust/tests/ui/proc-macro/auxiliary/multiple-derives.rs
2024-02-16 20:02:50 +00:00

23 lines
484 B
Rust

//@ force-host
//@ no-prefer-dynamic
#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::TokenStream;
macro_rules! make_derives {
($($name:ident),*) => {
$(
#[proc_macro_derive($name)]
pub fn $name(input: TokenStream) -> TokenStream {
println!("Derive {}: {}", stringify!($name), input);
TokenStream::new()
}
)*
}
}
make_derives!(First, Second, Third, Fourth, Fifth);