mirror of
https://github.com/openharmony/third_party_rust_syn.git
synced 2026-07-21 02:05:27 -04:00
defe751b28
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() {}
|
|
})
|
|
}
|