File tree 1 file changed +7
-4
lines changed
compiler/rustc_expand/src/mbe
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>(
516
516
bb_items : & mut SmallVec < [ MatcherPosHandle < ' root , ' tt > ; 1 ] > ,
517
517
token : & Token ,
518
518
) -> 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`.
520
521
let mut eof_items = EofItems :: None ;
521
522
522
523
// Pop items from `cur_items` until it is empty.
@@ -592,9 +593,11 @@ fn parse_tt_inner<'root, 'tt>(
592
593
// If we are not in a repetition, then being at the end of a matcher means that we
593
594
// have reached the potential end of the input.
594
595
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
+ }
598
601
}
599
602
}
600
603
} else {
You can’t perform that action at this time.
0 commit comments