about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2015-12-03 05:37:48 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2015-12-16 17:13:16 +0300
commite0ceef5a9e9224baf1f108ede1d1033e5e7fef08 (patch)
tree9b5a2df911400b1ff05bd8d12490dc6c6fccbb2b /src/libsyntax/parse
parentb8157cc67fa25f2944b24f4306151d53d1b80b56 (diff)
downloadrust-e0ceef5a9e9224baf1f108ede1d1033e5e7fef08.tar.gz
rust-e0ceef5a9e9224baf1f108ede1d1033e5e7fef08.zip
Add ExprType to HIR and make everything compile
+ Apply parser changes manually
+ Add feature gate
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e81f9a2a166..dd1fe22a4eb 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2789,6 +2789,10 @@ impl<'a> Parser<'a> {
                 lhs = self.mk_expr(lhs.span.lo, rhs.span.hi,
                                    ExprCast(lhs, rhs), None);
                 continue
+            } else if op == AssocOp::Colon {
+                let rhs = try!(self.parse_ty());
+                lhs = self.mk_expr(lhs.span.lo, rhs.span.hi, ExprType(lhs, rhs));
+                continue
             } else if op == AssocOp::DotDot {
                     // If we didn’t have to handle `x..`, it would be pretty easy to generalise
                     // it to the Fixity::None code.
@@ -2857,7 +2861,9 @@ impl<'a> Parser<'a> {
                     let aopexpr = self.mk_assign_op(codemap::respan(cur_op_span, aop), lhs, rhs);
                     self.mk_expr(lhs_span.lo, rhs_span.hi, aopexpr, None)
                 }
-                AssocOp::As | AssocOp::DotDot => self.bug("As or DotDot branch reached")
+                AssocOp::As | AssocOp::Colon | AssocOp::DotDot => {
+                    self.bug("As, Colon or DotDot branch reached")
+                }
             };
 
             if op.fixity() == Fixity::None { break }