about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 8b50a6270bc..f7bed002140 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1352,7 +1352,7 @@ impl<'a> Parser<'a> {
         } else if self.token == token::BINOP(token::STAR) {
             // STAR POINTER (bare pointer?)
             self.bump();
-            TyPtr(self.parse_mt())
+            TyPtr(self.parse_ptr())
         } else if self.token == token::LBRACKET {
             // VECTOR
             self.expect(&token::LBRACKET);
@@ -1429,6 +1429,19 @@ impl<'a> Parser<'a> {
         return TyRptr(opt_lifetime, mt);
     }
 
+    pub fn parse_ptr(&mut self) -> MutTy {
+        let mutbl = if self.eat_keyword(keywords::Mut) {
+            MutMutable
+        } else if self.eat_keyword(keywords::Const) {
+            MutImmutable
+        } else {
+            // NOTE: after a stage0 snap this should turn into a span_err.
+            MutImmutable
+        };
+        let t = self.parse_ty(true);
+        MutTy { ty: t, mutbl: mutbl }
+    }
+
     pub fn is_named_argument(&mut self) -> bool {
         let offset = match self.token {
             token::BINOP(token::AND) => 1,