Fix: Display the proper macro name in error
@@ -229,13 +229,13 @@ fn impl_gdnative_expose(ast: ItemImpl) -> (ItemImpl, ClassMethodExport) {
.last()
.map(|i| i.ident.to_string());
- let (is_export, is_old_syntax) = if let Some("export") = last_seg.as_deref()
- {
- (true, true)
+ let (is_export, is_old_syntax, macro_name) =
+ if let Some("export") = last_seg.as_deref() {
+ (true, true, "export")
} else if let Some("godot") = last_seg.as_deref() {
- (true, false)
+ (true, false, "godot")
} else {
- (false, false)
+ (false, false, "unknown")
};
if is_export {
@@ -363,7 +363,8 @@ fn impl_gdnative_expose(ast: ItemImpl) -> (ItemImpl, ClassMethodExport) {
}
} else {
let msg = format!(
- "unknown option for #[export]: `{}`",
+ "unknown option for #[{}]: `{}`",
+ macro_name,
path.to_token_stream()
);
errors.push(syn::Error::new(nested_meta.span(), msg));
