Fix array element supported condition
This disallows previously wrongly allowed array element types in PR 459
(such as [CxxString; N]) and allows previously disallowed but
unproblematic array element types (such as [&str; N]).
diff --git a/syntax/check.rs b/syntax/check.rs
index a926d1c..f077bd3 100644
--- a/syntax/check.rs
+++ b/syntax/check.rs
@@ -186,14 +186,13 @@
}
fn check_type_array(cx: &mut Check, ty: &Array) {
- match &ty.inner {
- Type::Ident(ident) => {
- if cx.types.rust.contains(&ident.rust) || cx.types.cxx.contains(&ident.rust) {
- cx.error(ty, "Only shared structs are supported in array yet");
- }
- }
- Type::RustBox(_) | Type::RustVec(_) | Type::CxxVector(_) | Type::UniquePtr(_) => {}
- _ => cx.error(ty, "unsupported array target type"),
+ let supported = match &ty.inner {
+ Type::Fn(_) => false,
+ element => !is_unsized(cx, element),
+ };
+
+ if !supported {
+ cx.error(ty, "unsupported array element type");
}
}