From c7f7821b9180854f7f5509f5117a862b285eb7fb Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 14 Apr 2021 12:33:11 +0200 Subject: derive macro: better error messages all error messages should now explicitly print that they occured while deriving a StaticType — before, they would just print out the error by itself, which could be confusing without context or knowing which derive-macro caused the error. --- dhall_proc_macros/src/derive.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'dhall_proc_macros') diff --git a/dhall_proc_macros/src/derive.rs b/dhall_proc_macros/src/derive.rs index 27d911f..0975d98 100644 --- a/dhall_proc_macros/src/derive.rs +++ b/dhall_proc_macros/src/derive.rs @@ -81,11 +81,11 @@ fn derive_for_enum( } syn::Fields::Unnamed(_) => Err(Error::new( v.span(), - "Variants with more than one field are not supported", + "Derive StaticType: Variants with more than one field are not supported", )), syn::Fields::Named(_) => Err(Error::new( v.span(), - "Named variants are not supported", + "Derive StaticType: Named variants are not supported", )), } }) @@ -111,14 +111,14 @@ pub fn derive_static_type_inner( syn::Data::Enum(data) if data.variants.is_empty() => { return Err(Error::new( input.span(), - "Empty enums are not supported", + "Derive StaticType: Empty enums are not supported", )) } syn::Data::Enum(data) => derive_for_enum(data, &mut constraints)?, syn::Data::Union(x) => { return Err(Error::new( x.union_token.span(), - "Unions are not supported", + "Derive StaticType: Unions are not supported", )) } }; -- cgit v1.2.3