summaryrefslogtreecommitdiffstats
path: root/src/test/ui/proc-macro/auxiliary/expand-with-a-macro.rs
blob: d779d57af14c7a12ccde94871c96176a69cad71e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]
#![deny(warnings)]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_derive(A)]
pub fn derive(input: TokenStream) -> TokenStream {
    let input = input.to_string();
    assert!(input.contains("struct A ;"));
    r#"
        impl A {
            fn a(&self) {
                panic!("hello");
            }
        }
    "#.parse().unwrap()
}