docs(macros/generate): Improve error output
This commit is contained in:
parent
febb2deae3
commit
73416da73c
|
@ -68,7 +68,9 @@ impl Type {
|
||||||
.map(|r#type| r#type.to_auxiliary_c(false, field_name))
|
.map(|r#type| r#type.to_auxiliary_c(false, field_name))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let field_name = field_name.expect("This is some, when I'm a function type").to_rust();
|
let field_name = field_name
|
||||||
|
.expect("This is some, when it's a function type")
|
||||||
|
.to_rust();
|
||||||
|
|
||||||
quote! {
|
quote! {
|
||||||
#output (*#field_name) (#(#inputs),*)
|
#output (*#field_name) (#(#inputs),*)
|
||||||
|
|
|
@ -34,7 +34,9 @@ pub mod rust;
|
||||||
|
|
||||||
pub fn format_rust(input: TokenStream2) -> String {
|
pub fn format_rust(input: TokenStream2) -> String {
|
||||||
prettyplease::unparse(
|
prettyplease::unparse(
|
||||||
&syn::parse2(input).expect("This code was generated, it should also be parsable"),
|
&syn::parse2(input.clone()).map_err(|err| {
|
||||||
|
eprintln!("{}:\n===\n{}\n===\n", err, input);
|
||||||
|
}).expect("This code was generated, it should also be parsable"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue