File tree 1 file changed +6
-5
lines changed
compiler/rustc_expand/src/mbe
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -593,11 +593,9 @@ impl TtParser {
593
593
}
594
594
}
595
595
596
- seq @ ( TokenTree :: Delimited ( ..)
597
- | TokenTree :: Token ( Token { kind : DocComment ( ..) , .. } ) ) => {
598
- // To descend into a delimited submatcher or a doc comment, we push the
599
- // current matcher onto a stack and push a new item containing the
600
- // submatcher onto `cur_items`.
596
+ seq @ TokenTree :: Delimited ( ..) => {
597
+ // To descend into a delimited submatcher, we push the current matcher onto
598
+ // a stack and push a new item containing the submatcher onto `cur_items`.
601
599
//
602
600
// At the beginning of the loop, if we reach the end of the delimited
603
601
// submatcher, we pop the stack to backtrack out of the descent.
@@ -609,6 +607,9 @@ impl TtParser {
609
607
}
610
608
611
609
TokenTree :: Token ( t) => {
610
+ // Doc comments cannot appear in a matcher.
611
+ debug_assert ! ( !matches!( t, Token { kind: DocComment ( ..) , .. } ) ) ;
612
+
612
613
// If the token matches, we can just advance the parser. Otherwise, this
613
614
// match hash failed, there is nothing to do, and hopefully another item in
614
615
// `cur_items` will match.
You can’t perform that action at this time.
0 commit comments