mlua_derive: Reject static field functions with args

This commit is contained in:
Alex Orlenko
2026-05-30 12:46:31 +01:00
parent 1d4a756436
commit 1f3dafa564
4 changed files with 29 additions and 0 deletions
@@ -335,6 +335,14 @@ pub fn userdata_impl(attr: TokenStream, item: TokenStream) -> TokenStream {
.to_compile_error()
.into();
}
if !info.args.is_empty() {
return syn::Error::new_spanned(
&method.sig,
"field function must not take arguments",
)
.to_compile_error()
.into();
}
let lua_name = lua_attr.name(fn_name);
if lua_attr.meta {
let tokens = quote! {