From 0828efd72f0c1a1823426f327cddfbced535117a Mon Sep 17 00:00:00 2001 From: Potpourri Date: Sun, 1 Feb 2015 00:59:58 +0300 Subject: Reject syntax like `use foo::bar::;` and `use foo:: as bar;` and keywords in view path idents --- src/libsyntax/parse/parser.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/parse') 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 } } -- cgit 1.4.1-3-g733a5