blob: 2a92550511fa3b6e839f16881232e5eb7b7ce578 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
extern crate proc_macro;
use proc_macro::TokenStream;
use quote::quote;
use syn::File;
#[proc_macro]
pub fn r#mod(input: TokenStream) -> TokenStream {
let compile_error = syn::parse::<File>(input)
.map(|file| println!("{:#?}", file))
.map_err(|err| err.to_compile_error())
.err();
TokenStream::from(quote! {
#compile_error
fn main() {}
})
}
|