Implement restrictions on placement of ()
diff --git a/syntax/check.rs b/syntax/check.rs
index 81e1f05..ef3faff 100644
--- a/syntax/check.rs
+++ b/syntax/check.rs
@@ -1,5 +1,5 @@
use crate::syntax::atom::Atom::{self, *};
-use crate::syntax::{error, ident, Api, ExternFn, Ty1, Type, Types, Var};
+use crate::syntax::{error, ident, Api, ExternFn, Ref, Ty1, Type, Types, Var};
use proc_macro2::Ident;
use syn::{Error, Result};
@@ -40,6 +40,11 @@
}
errors.push(unsupported_unique_ptr_target(ptr));
}
+ Type::Ref(ty) => {
+ if let Type::Void(_) = ty.inner {
+ errors.push(unsupported_reference_type(ty));
+ }
+ }
_ => {}
}
}
@@ -94,6 +99,7 @@
fn is_unsized(ty: &Type, types: &Types) -> bool {
let ident = match ty {
Type::Ident(ident) => ident,
+ Type::Void(_) => return true,
_ => return false,
};
ident == CxxString || types.cxx.contains(ident) || types.rust.contains(ident)
@@ -169,6 +175,10 @@
Error::new(ident.span(), "unsupported type")
}
+fn unsupported_reference_type(ty: &Ref) -> Error {
+ Error::new_spanned(ty, "unsupported reference type")
+}
+
fn unsupported_cxx_type_in_box(unique_ptr: &Ty1) -> Error {
Error::new_spanned(unique_ptr, error::BOX_CXX_TYPE.msg)
}