Rollup merge of #128994 - nnethercote:fix-Parser-look_ahead-more, r=compiler-errors
Fix bug in `Parser::look_ahead`. The special case was failing to handle invisible delimiters on one path. Fixes (but doesn't close until beta backported) #128895. r? `@davidtwco`
This commit is contained in:
commit
99a785d62d
3 changed files with 64 additions and 4 deletions
|
@ -1167,10 +1167,12 @@ impl<'a> Parser<'a> {
|
|||
match self.token_cursor.tree_cursor.look_ahead(0) {
|
||||
Some(tree) => {
|
||||
// Indexing stayed within the current token tree.
|
||||
return match tree {
|
||||
TokenTree::Token(token, _) => looker(token),
|
||||
TokenTree::Delimited(dspan, _, delim, _) => {
|
||||
looker(&Token::new(token::OpenDelim(*delim), dspan.open))
|
||||
match tree {
|
||||
TokenTree::Token(token, _) => return looker(token),
|
||||
&TokenTree::Delimited(dspan, _, delim, _) => {
|
||||
if delim != Delimiter::Invisible {
|
||||
return looker(&Token::new(token::OpenDelim(delim), dspan.open));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue