File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
compiler/rustc_expand/src/mbe Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -516,7 +516,8 @@ fn parse_tt_inner<'root, 'tt>(
516516 bb_items : & mut SmallVec < [ MatcherPosHandle < ' root , ' tt > ; 1 ] > ,
517517 token : & Token ,
518518) -> Option < NamedParseResult > {
519- // Matcher positions that would be valid if the macro invocation was over now
519+ // Matcher positions that would be valid if the macro invocation was over now. Only modified if
520+ // `token == Eof`.
520521 let mut eof_items = EofItems :: None ;
521522
522523 // Pop items from `cur_items` until it is empty.
@@ -592,9 +593,11 @@ fn parse_tt_inner<'root, 'tt>(
592593 // If we are not in a repetition, then being at the end of a matcher means that we
593594 // have reached the potential end of the input.
594595 debug_assert_eq ! ( idx, len) ;
595- eof_items = match eof_items {
596- EofItems :: None => EofItems :: One ( item) ,
597- EofItems :: One ( _) | EofItems :: Multiple => EofItems :: Multiple ,
596+ if * token == token:: Eof {
597+ eof_items = match eof_items {
598+ EofItems :: None => EofItems :: One ( item) ,
599+ EofItems :: One ( _) | EofItems :: Multiple => EofItems :: Multiple ,
600+ }
598601 }
599602 }
600603 } else {
You can’t perform that action at this time.
0 commit comments