When tokenising, use semi-colons to hint error recovery #31528
Labels
A-parser
Area: The lexing & parsing of Rust source code to an AST
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
e.g.,
When we hit
}
, we know that the delimiters are mismatched, we currently close all the token trees to recover, but that then gives us a bunch of errors in parsing. We should rewind to the;
and treat that kind of like an EOF, closing the(
and then continuing to tokenise from the;
.Annoyingly we can't do this eagerly since
;
could always be expected. For parens though, this can only happen in macros, so I think for error recovery we can assume the;
terminates a token tree.We could do better by tracking whether we are in macro context during tokenising.
The text was updated successfully, but these errors were encountered: