1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// check-pass #![allow(unused_must_use)] #![feature(decl_macro)] pub macro create_struct($a:ident) { struct $a; impl Clone for $a { fn clone(&self) -> Self { $a } } } fn main() { create_struct!(Test); Test.clone(); }