summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorMark-Simulacrum <mark.simulacrum@gmail.com>2016-11-12 07:41:26 -0700
committerMark-Simulacrum <mark.simulacrum@gmail.com>2016-11-12 07:41:26 -0700
commit38912ee3d43868651e8ac6fc3da1153f45ba5cf4 (patch)
treee063824fd374b5c0c0b3193070beec0664445316 /src/libsyntax/ext
parent6046595e34737d7bec851bfd1352a01e58fe99e9 (diff)
downloadrust-38912ee3d43868651e8ac6fc3da1153f45ba5cf4.tar.gz
rust-38912ee3d43868651e8ac6fc3da1153f45ba5cf4.zip
Move next_eis out of main loop to avoid re-allocating and dropping it.
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index a072f2ba948..d4371830562 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -410,11 +410,12 @@ fn inner_parse_loop(cur_eis: &mut SmallVector<Box<MatcherPos>>,
 pub fn parse(sess: &ParseSess, rdr: TtReader, ms: &[TokenTree]) -> NamedParseResult {
     let mut parser = Parser::new_with_doc_flag(sess, Box::new(rdr), true);
     let mut cur_eis = SmallVector::one(initial_matcher_pos(ms.to_owned(), parser.span.lo));
+    let mut next_eis = Vec::new(); // or proceed normally
 
     loop {
         let mut bb_eis = SmallVector::new(); // black-box parsed by parser.rs
         let mut eof_eis = SmallVector::new();
-        let mut next_eis = Vec::new(); // or proceed normally
+        assert!(next_eis.is_empty());
 
         match inner_parse_loop(&mut cur_eis, &mut next_eis, &mut eof_eis, &mut bb_eis,
                                &parser.token, &parser.span) {