Skip to content

Commit 7f4a1dc

Browse files
authored
Merge pull request #1352 from zecakeh/replace-zero-variant-error
glib-macros: Improve error message when `Properties` struct doesn't have at least one `#[property(…)]`
2 parents 8ba1670 + 7b03717 commit 7f4a1dc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

glib-macros/src/properties.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ impl Parse for PropsMacroInput {
8585
))
8686
}
8787
};
88+
if props.is_empty() {
89+
return Err(syn::Error::new(
90+
proc_macro2::Span::call_site(),
91+
"Struct must have at least one field with the #[property(…)] attribute",
92+
));
93+
}
8894
Ok(Self {
8995
wrapper_ty: attrs.wrapper_ty,
9096
ext_trait: attrs.ext_trait,

0 commit comments

Comments
 (0)