Fix ConstExpr::Other handling
diff --git a/src/constant.rs b/src/constant.rs
index d0f11b5..145729d 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -43,8 +43,6 @@
use lit::parsing::lit;
use op::parsing::{binop, unop};
use ty::parsing::{path, ty};
- #[cfg(feature = "full")] use expr::parsing::expr;
- #[cfg(not(feature = "full"))] use synom::IResult;
named!(pub const_expr -> ConstExpr, do_parse!(
mut e: alt!(
@@ -55,8 +53,11 @@
expr_path
|
expr_paren
- |
- expr_other
+ // Cannot handle ConstExpr::Other here because for example
+ // `[u32; n!()]` would end up successfully parsing `n` as
+ // ConstExpr::Path and then fail to parse `!()`. Instead, callers
+ // are required to handle Other. See ty::parsing::array_len and
+ // data::parsing::discriminant.
) >>
many0!(alt!(
tap!(args: and_call => {
@@ -98,14 +99,6 @@
named!(expr_path -> ConstExpr, map!(path, ConstExpr::Path));
- #[cfg(feature = "full")]
- named!(expr_other -> ConstExpr, map!(expr, ConstExpr::Other));
-
- #[cfg(not(feature = "full"))]
- fn expr_other(_: &str) -> IResult<&str, ConstExpr> {
- IResult::Error
- }
-
named!(and_index -> ConstExpr, delimited!(punct!("["), const_expr, punct!("]")));
named!(expr_paren -> ConstExpr, do_parse!(