summaryrefslogtreecommitdiffstats
path: root/tests/ui/proc-macro/auxiliary/make-macro.rs
blob: 3c851b6de2a1ac8f624780246c37871dcce3da86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// force-host

#[macro_export]
macro_rules! make_it {
    ($name:ident) => {
        #[proc_macro]
        pub fn $name(input: TokenStream) -> TokenStream {
            println!("Def site: {:?}", Span::def_site());
            println!("Input: {:?}", input);
            let new: TokenStream = input.into_iter().map(|mut t| {
                t.set_span(Span::def_site());
                t
            }).collect();
            println!("Respanned: {:?}", new);
            new
        }
    };
}