diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-19 13:53:05 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-04-19 17:02:49 +1000 |
| commit | d235ac7801367afcdd0712c43dd53fab7d6ff95b (patch) | |
| tree | 6bf54d1e623f45c62c52bb95140e39562f52f327 /compiler/rustc_parse/src/parser/mod.rs | |
| parent | 29c78cc086d55b46401f3ba9ca89ad6e95c57c8d (diff) | |
| download | rust-d235ac7801367afcdd0712c43dd53fab7d6ff95b.tar.gz rust-d235ac7801367afcdd0712c43dd53fab7d6ff95b.zip | |
Handle `Delimited` opening immediately.
Instead of letting the next iteration of the loop handle it.
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 2e2fc6694a5..20f8ab8a6e7 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -274,8 +274,10 @@ impl TokenCursor { break (token, spacing); } TokenTree::Delimited(sp, delim, tts) => { - let frame = TokenCursorFrame::new(sp, delim, false, tts, false); + // Set `open_delim` to true here because we deal with it immediately. + let frame = TokenCursorFrame::new(sp, delim, true, tts, false); self.stack.push(mem::replace(&mut self.frame, frame)); + return (Token::new(token::OpenDelim(delim), sp.open), Spacing::Alone); } } } else if !self.frame.close_delim { |
