mirror of
https://gitee.com/openharmony/third_party_rust_syn
synced 2024-11-23 16:00:10 +00:00
5b351e5a82
Hides an unnecessary extra error: error[E0601]: `main` function not found in crate `syn_dev` | = note: consider adding a `main` function to `dev/main.rs`
19 lines
396 B
Rust
19 lines
396 B
Rust
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() {}
|
|
})
|
|
}
|