Closed
Description
e.g.,
pub fn trace_option(option: Option<isize>) {
option.map(|some| 42;
}
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.