]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/tt/macro_parser.rs
Provide specific label for patern parsing error
[rust.git] / src / libsyntax / ext / tt / macro_parser.rs
index 941fd6f1000a326d07b342911f7da5af098a68e2..d6c95a3d7c8eca4d0f6d75f34121b3ad648f93ad 100644 (file)
@@ -92,7 +92,7 @@
 use parse::parser::{Parser, PathStyle};
 use parse::token::{self, DocComment, Nonterminal, Token};
 use print::pprust;
-use OneVector;
+use smallvec::SmallVec;
 use symbol::keywords;
 use tokenstream::{DelimSpan, TokenStream};
 
@@ -440,10 +440,10 @@ fn token_name_eq(t1: &Token, t2: &Token) -> bool {
 /// A `ParseResult`. Note that matches are kept track of through the items generated.
 fn inner_parse_loop<'a>(
     sess: &ParseSess,
-    cur_items: &mut OneVector<MatcherPosHandle<'a>>,
+    cur_items: &mut SmallVec<[MatcherPosHandle<'a>; 1]>,
     next_items: &mut Vec<MatcherPosHandle<'a>>,
-    eof_items: &mut OneVector<MatcherPosHandle<'a>>,
-    bb_items: &mut OneVector<MatcherPosHandle<'a>>,
+    eof_items: &mut SmallVec<[MatcherPosHandle<'a>; 1]>,
+    bb_items: &mut SmallVec<[MatcherPosHandle<'a>; 1]>,
     token: &Token,
     span: syntax_pos::Span,
 ) -> ParseResult<()> {
@@ -649,10 +649,10 @@ pub fn parse(
 
     loop {
         // Matcher positions black-box parsed by parser.rs (`parser`)
-        let mut bb_items = OneVector::new();
+        let mut bb_items = SmallVec::new();
 
         // Matcher positions that would be valid if the macro invocation was over now
-        let mut eof_items = OneVector::new();
+        let mut eof_items = SmallVec::new();
         assert!(next_items.is_empty());
 
         // Process `cur_items` until either we have finished the input or we need to get some
@@ -881,7 +881,7 @@ fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal {
                 FatalError.raise();
             }
         },
-        "pat" => token::NtPat(panictry!(p.parse_pat())),
+        "pat" => token::NtPat(panictry!(p.parse_pat(None))),
         "expr" => token::NtExpr(panictry!(p.parse_expr())),
         "literal" => token::NtLiteral(panictry!(p.parse_literal_maybe_minus())),
         "ty" => token::NtTy(panictry!(p.parse_ty())),