diff options
| author | Sasha <sasha.pourcelot@protonmail.com> | 2020-08-31 11:45:50 +0200 |
|---|---|---|
| committer | Sasha <sasha.pourcelot@protonmail.com> | 2020-09-02 13:18:19 +0200 |
| commit | 3524c3ef4371d0bf4dd03568a004039f18c154f7 (patch) | |
| tree | df930f571870d0e30547397d1841307b00afb224 /compiler/rustc_parse | |
| parent | 8ed5cb56b5e5cc216eb6820a44dd4f7ef65107b0 (diff) | |
| download | rust-3524c3ef4371d0bf4dd03568a004039f18c154f7.tar.gz rust-3524c3ef4371d0bf4dd03568a004039f18c154f7.zip | |
Improve recovery on malformed format call
If a comma in a format call is replaced with a similar token, then we emit an error and continue parsing, instead of stopping at this point.
Diffstat (limited to 'compiler/rustc_parse')
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index d67ed74bc99..999853c4b8c 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1233,6 +1233,10 @@ impl<'a> Parser<'a> { *t == token::OpenDelim(token::Brace) || *t == token::BinOp(token::Star) }) } + + pub fn clear_expected_tokens(&mut self) { + self.expected_tokens.clear(); + } } crate fn make_unclosed_delims_error( |
