about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorPotpourri <pot_pourri@mail.ru>2015-02-01 00:59:58 +0300
committerPotpourri <pot_pourri@mail.ru>2015-02-01 23:31:21 +0300
commit0828efd72f0c1a1823426f327cddfbced535117a (patch)
treee346e0e79ae781e83abc12d9e1f22daff2038e4e /src/libsyntax/parse
parent76ce1ea42158b5be3f3896df708602918d202947 (diff)
downloadrust-0828efd72f0c1a1823426f327cddfbced535117a.tar.gz
rust-0828efd72f0c1a1823426f327cddfbced535117a.zip
Reject syntax like `use foo::bar::;` and `use foo:: as bar;` and keywords in view path idents
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index d99095eeba3..e2b58e6d87e 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5912,9 +5912,9 @@ impl<'a> Parser<'a> {
                 self.bump();
 
                 match self.token {
-                  token::Ident(i, _) => {
-                    self.bump();
-                    path.push(i);
+                  token::Ident(..) => {
+                    let ident = self.parse_ident();
+                    path.push(ident);
                   }
 
                   // foo::bar::{a,b,c}
@@ -5954,6 +5954,11 @@ impl<'a> Parser<'a> {
                     return P(spanned(lo, self.span.hi, ViewPathGlob(path)));
                   }
 
+                  // fall-through for case foo::bar::;
+                  token::Semi => {
+                    self.span_err(self.span, "expected identifier or `{` or `*`, found `;`");
+                  }
+
                   _ => break
                 }
             }