Skip to content

Commit 38912ee

Browse files
Move next_eis out of main loop to avoid re-allocating and dropping it.
1 parent 6046595 commit 38912ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libsyntax/ext/tt/macro_parser.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,12 @@ fn inner_parse_loop(cur_eis: &mut SmallVector<Box<MatcherPos>>,
410410
pub fn parse(sess: &ParseSess, rdr: TtReader, ms: &[TokenTree]) -> NamedParseResult {
411411
let mut parser = Parser::new_with_doc_flag(sess, Box::new(rdr), true);
412412
let mut cur_eis = SmallVector::one(initial_matcher_pos(ms.to_owned(), parser.span.lo));
413+
let mut next_eis = Vec::new(); // or proceed normally
413414

414415
loop {
415416
let mut bb_eis = SmallVector::new(); // black-box parsed by parser.rs
416417
let mut eof_eis = SmallVector::new();
417-
let mut next_eis = Vec::new(); // or proceed normally
418+
assert!(next_eis.is_empty());
418419

419420
match inner_parse_loop(&mut cur_eis, &mut next_eis, &mut eof_eis, &mut bb_eis,
420421
&parser.token, &parser.span) {

0 commit comments

Comments
 (0)