Merge pull request #1297 from adamcrume/master

Use compile_error! instead of panicking
This commit is contained in:
David Tolnay authored and GitHub committed 2018-06-02 22:00:24 -07:00
commit 7ad3d17e59
63 files changed
+106 -126

No files matched your search

+3 -2
View File
@@ -53,6 +53,7 @@ extern crate proc_macro2;
mod internals;
use std::str::FromStr;
use proc_macro::TokenStream;
use syn::DeriveInput;
@@ -71,7 +72,7 @@ pub fn derive_serialize(input: TokenStream) -> TokenStream {
let input: DeriveInput = syn::parse(input).unwrap();
match ser::expand_derive_serialize(&input) {
Ok(expanded) => expanded.into(),
Err(msg) => panic!(msg),
Err(msg) => quote! {compile_error!(#msg);}.into(),
}
}
@@ -80,6 +81,6 @@ pub fn derive_deserialize(input: TokenStream) -> TokenStream {
let input: DeriveInput = syn::parse(input).unwrap();
match de::expand_derive_deserialize(&input) {
Ok(expanded) => expanded.into(),
Err(msg) => panic!(msg),
Err(msg) => quote! {compile_error!(#msg);}.into(),
}
}