]> git.lizzy.rs Git - rust.git/blob - tests/ui/proc-macro/auxiliary/expand-with-a-macro.rs
Merge commit '598f0909568a51de8a2d1148f55a644fd8dffad0' into sync_cg_clif-2023-01-24
[rust.git] / tests / ui / proc-macro / auxiliary / expand-with-a-macro.rs
1 // force-host
2 // no-prefer-dynamic
3
4 #![crate_type = "proc-macro"]
5 #![deny(warnings)]
6
7 extern crate proc_macro;
8
9 use proc_macro::TokenStream;
10
11 #[proc_macro_derive(A)]
12 pub fn derive(input: TokenStream) -> TokenStream {
13     let input = input.to_string();
14     assert!(input.contains("struct A ;"));
15     r#"
16         impl A {
17             fn a(&self) {
18                 panic!("hello");
19             }
20         }
21     "#.parse().unwrap()
22 }