Fix ConstExpr::Other handling
diff --git a/src/ty.rs b/src/ty.rs
index f0cc88c..efc5cca 100644
--- a/src/ty.rs
+++ b/src/ty.rs
@@ -278,29 +278,28 @@
(Ty::Slice(Box::new(elem)))
));
- #[cfg(not(feature = "full"))]
named!(ty_array -> Ty, do_parse!(
punct!("[") >>
elem: ty >>
punct!(";") >>
- len: const_expr >>
+ len: array_len >>
punct!("]") >>
(Ty::Array(Box::new(elem), len))
));
+ #[cfg(not(feature = "full"))]
+ use self::const_expr as array_len;
+
#[cfg(feature = "full")]
- named!(ty_array -> Ty, do_parse!(
- punct!("[") >>
- elem: ty >>
- punct!(";") >>
- len: alt!(
- terminated!(const_expr, punct!("]"))
- |
- terminated!(expr, punct!("]")) => { ConstExpr::Other }
- ) >>
- (Ty::Array(Box::new(elem), len))
+ named!(array_len -> ConstExpr, alt!(
+ terminated!(const_expr, after_array_len)
+ |
+ terminated!(expr, after_array_len) => { ConstExpr::Other }
));
+ #[cfg(feature = "full")]
+ named!(after_array_len -> &str, peek!(punct!("]")));
+
named!(ty_ptr -> Ty, do_parse!(
punct!("*") >>
mutability: alt!(