diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-01 12:43:13 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-02-03 10:06:52 +1100 |
| commit | b5ecbbb998aae80541d70bf5c93be92e6c59a7a8 (patch) | |
| tree | 5113f17ff004a5b175a4d5a23e0f17b14e1c79dd /compiler/rustc_parse/src/parser/expr.rs | |
| parent | b23f272db017c3bfd8cdf57fad6e5fdd057168c6 (diff) | |
| download | rust-b5ecbbb998aae80541d70bf5c93be92e6c59a7a8.tar.gz rust-b5ecbbb998aae80541d70bf5c93be92e6c59a7a8.zip | |
Remove `TokenCursorFrame`.
The motivation here is to eliminate the `Option<(Delimiter, DelimSpan)>`, which is `None` for the outermost token stream and `Some` for all other token streams. We are already treating the innermost frame specially -- this is the `frame` vs `stack` distinction in `TokenCursor`. We can push that further so that `frame` only contains the cursor, and `stack` elements contain the delimiters for their children. When we are in the outermost token stream `stack` is empty, so there are no stored delimiters, which is what we want because the outermost token stream *has* no delimiters. This change also shrinks `TokenCursor`, which shrinks `Parser` and `LazyAttrTokenStreamImpl`, which is nice.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index b7a023868fc..68849f817aa 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2141,7 +2141,7 @@ impl<'a> Parser<'a> { } if self.token.kind == TokenKind::Semi - && matches!(self.token_cursor.frame.delim_sp, Some((Delimiter::Parenthesis, _))) + && matches!(self.token_cursor.stack.last(), Some((_, Delimiter::Parenthesis, _))) && self.may_recover() { // It is likely that the closure body is a block but where the |
