File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
compiler/rustc_expand/src/mbe Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -593,11 +593,9 @@ impl TtParser {
593593 }
594594 }
595595
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`.
601599 //
602600 // At the beginning of the loop, if we reach the end of the delimited
603601 // submatcher, we pop the stack to backtrack out of the descent.
@@ -609,6 +607,9 @@ impl TtParser {
609607 }
610608
611609 TokenTree :: Token ( t) => {
610+ // Doc comments cannot appear in a matcher.
611+ debug_assert ! ( !matches!( t, Token { kind: DocComment ( ..) , .. } ) ) ;
612+
612613 // If the token matches, we can just advance the parser. Otherwise, this
613614 // match hash failed, there is nothing to do, and hopefully another item in
614615 // `cur_items` will match.
You can’t perform that action at this time.
0 commit comments