Skip to content

Commit

Permalink
panic
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 5, 2019
1 parent 294c084 commit 149ca1a
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions demo/impl/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
use proc_macro2::TokenStream;
use quote::quote;
use syn::DeriveInput;

#[no_mangle]
pub extern "C" fn demo(input: TokenStream) -> TokenStream {
let input: DeriveInput = match syn::parse2(input) {
Ok(input) => input,
Err(err) => return err.to_compile_error(),
};

let ident = input.ident;
let message = format!("Hello from WASM! My name is {}.", ident);

quote! {
impl #ident {
pub const MESSAGE: &'static str = #message;
}
}
pub extern "C" fn demo(_input: TokenStream) -> TokenStream {
panic!("oh no!");
}

0 comments on commit 149ca1a

Please sign in to comment.