Allow array index as constant expression
diff --git a/src/constant.rs b/src/constant.rs
index f0ec2c5..1688dbf 100644
--- a/src/constant.rs
+++ b/src/constant.rs
@@ -18,6 +18,8 @@
     /// Variable reference, possibly containing `::` and/or type
     /// parameters, e.g. foo::bar::<baz>.
     Path(Path),
+    /// An indexing operation (`foo[2]`)
+    Index(Box<ConstExpr>, Box<ConstExpr>),
     /// No-op: used solely so we can pretty-print faithfully
     Paren(Box<ConstExpr>),
 }
@@ -53,6 +55,10 @@
             tap!(ty: and_cast => {
                 e = ConstExpr::Cast(Box::new(e), Box::new(ty));
             })
+            |
+            tap!(i: and_index => {
+                e = ConstExpr::Index(Box::new(e), Box::new(i));
+            })
         )) >>
         (e)
     ));
@@ -76,6 +82,8 @@
 
     named!(expr_path -> ConstExpr, map!(path, ConstExpr::Path));
 
+    named!(and_index -> ConstExpr, delimited!(punct!("["), const_expr, punct!("]")));
+
     named!(expr_paren -> ConstExpr, do_parse!(
         punct!("(") >>
         e: const_expr >>
@@ -120,6 +128,12 @@
                     ty.to_tokens(tokens);
                 }
                 ConstExpr::Path(ref path) => path.to_tokens(tokens),
+                ConstExpr::Index(ref expr, ref index) => {
+                    expr.to_tokens(tokens);
+                    tokens.append("[");
+                    index.to_tokens(tokens);
+                    tokens.append("]");
+                }
                 ConstExpr::Paren(ref expr) => {
                     tokens.append("(");
                     expr.to_tokens(tokens);