about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-02 11:01:17 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-02 11:01:17 -0800
commit3ef2df9e88ea20b661a8e313cf0e661595c516c9 (patch)
treea39e4b2b6a64627cbe89f49381f391ebabd4fcbb /src/libsyntax/parse
parent99b2bd4bfa332c5a723114d09e8bb74d5a0c7376 (diff)
parent0828efd72f0c1a1823426f327cddfbced535117a (diff)
downloadrust-3ef2df9e88ea20b661a8e313cf0e661595c516c9.tar.gz
rust-3ef2df9e88ea20b661a8e313cf0e661595c516c9.zip
rollup merge of #21845: Potpourri/import-syntax
syntax like `use foo::bar::;` and `use foo:: as bar;` should be rejected, see issue #21629
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 c56734439eb..c3182602a4b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5917,9 +5917,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}
@@ -5959,6 +5959,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
                 }
             }