summaryrefslogtreecommitdiff
path: root/mlua_derive/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mlua_derive/src/lib.rs')
-rw-r--r--mlua_derive/src/lib.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/mlua_derive/src/lib.rs b/mlua_derive/src/lib.rs
index 6267a02..b5128fc 100644
--- a/mlua_derive/src/lib.rs
+++ b/mlua_derive/src/lib.rs
@@ -18,7 +18,14 @@ struct ModuleAttributes {
impl ModuleAttributes {
fn parse(&mut self, meta: ParseNestedMeta) -> Result<()> {
if meta.path.is_ident("name") {
- self.name = Some(meta.value()?.parse::<LitStr>()?.parse()?);
+ match meta.value() {
+ Ok(value) => {
+ self.name = Some(value.parse::<LitStr>()?.parse()?);
+ }
+ Err(_) => {
+ return Err(meta.error(format!("`name` attribute must have a value")));
+ }
+ }
} else {
return Err(meta.error("unsupported module attribute"));
}